cn.hutool.crypto.asymmetric.SignAlgorithm Java Examples
The following examples show how to use
cn.hutool.crypto.asymmetric.SignAlgorithm.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecurityTools.java From jeecg-cloud with Apache License 2.0 | 6 votes |
public static SecurityResp valid(SecurityReq req) { SecurityResp resp=new SecurityResp(); String pubKey=req.getPubKey(); String aesKey=req.getAesKey(); String data=req.getData(); String signData=req.getSignData(); RSA rsa=new RSA(null, Base64Decoder.decode(pubKey)); Sign sign= new Sign(SignAlgorithm.SHA1withRSA,null,pubKey); byte[] decryptAes = rsa.decrypt(aesKey, KeyType.PublicKey); //log.info("rsa解密后的秘钥"+ Base64Encoder.encode(decryptAes)); AES aes = SecureUtil.aes(decryptAes); String dencrptValue =aes.decryptStr(data); //log.info("解密后报文"+dencrptValue); resp.setData(new JSONObject(dencrptValue)); boolean verify = sign.verify(dencrptValue.getBytes(), Base64Decoder.decode(signData)); resp.setSuccess(verify); return resp; }
Example #2
Source File: SecurityTools.java From jeecg-boot-with-activiti with MIT License | 6 votes |
public static SecurityResp valid(SecurityReq req) { SecurityResp resp=new SecurityResp(); String pubKey=req.getPubKey(); String aesKey=req.getAesKey(); String data=req.getData(); String signData=req.getSignData(); RSA rsa=new RSA(null, Base64Decoder.decode(pubKey)); Sign sign= new Sign(SignAlgorithm.SHA1withRSA,null,pubKey); byte[] decryptAes = rsa.decrypt(aesKey, KeyType.PublicKey); //log.info("rsa解密后的秘钥"+ Base64Encoder.encode(decryptAes)); AES aes = SecureUtil.aes(decryptAes); String dencrptValue =aes.decryptStr(data); //log.info("解密后报文"+dencrptValue); resp.setData(new JSONObject(dencrptValue)); boolean verify = sign.verify(dencrptValue.getBytes(), Base64Decoder.decode(signData)); resp.setSuccess(verify); return resp; }
Example #3
Source File: SecurityTools.java From teaching with Apache License 2.0 | 6 votes |
public static SecurityResp valid(SecurityReq req) { SecurityResp resp=new SecurityResp(); String pubKey=req.getPubKey(); String aesKey=req.getAesKey(); String data=req.getData(); String signData=req.getSignData(); RSA rsa=new RSA(null, Base64Decoder.decode(pubKey)); Sign sign= new Sign(SignAlgorithm.SHA1withRSA,null,pubKey); byte[] decryptAes = rsa.decrypt(aesKey, KeyType.PublicKey); //log.info("rsa解密后的秘钥"+ Base64Encoder.encode(decryptAes)); AES aes = SecureUtil.aes(decryptAes); String dencrptValue =aes.decryptStr(data); //log.info("解密后报文"+dencrptValue); resp.setData(new JSONObject(dencrptValue)); boolean verify = sign.verify(dencrptValue.getBytes(), Base64Decoder.decode(signData)); resp.setSuccess(verify); return resp; }
Example #4
Source File: SecurityTools.java From jeecg-boot with Apache License 2.0 | 6 votes |
public static SecurityResp valid(SecurityReq req) { SecurityResp resp=new SecurityResp(); String pubKey=req.getPubKey(); String aesKey=req.getAesKey(); String data=req.getData(); String signData=req.getSignData(); RSA rsa=new RSA(null, Base64Decoder.decode(pubKey)); Sign sign= new Sign(SignAlgorithm.SHA1withRSA,null,pubKey); byte[] decryptAes = rsa.decrypt(aesKey, KeyType.PublicKey); //log.info("rsa解密后的秘钥"+ Base64Encoder.encode(decryptAes)); AES aes = SecureUtil.aes(decryptAes); String dencrptValue =aes.decryptStr(data); //log.info("解密后报文"+dencrptValue); resp.setData(new JSONObject(dencrptValue)); boolean verify = sign.verify(dencrptValue.getBytes(), Base64Decoder.decode(signData)); resp.setSuccess(verify); return resp; }
Example #5
Source File: SecurityTools.java From jeecg-cloud with Apache License 2.0 | 5 votes |
public static MyKeyPair generateKeyPair(){ KeyPair keyPair= SecureUtil.generateKeyPair(SignAlgorithm.SHA1withRSA.getValue(),2048); String priKey= Base64Encoder.encode(keyPair.getPrivate().getEncoded()); String pubkey= Base64Encoder.encode(keyPair.getPublic().getEncoded()); MyKeyPair resp=new MyKeyPair(); resp.setPriKey(priKey); resp.setPubKey(pubkey); return resp; }
Example #6
Source File: SecurityTools.java From jeecg-boot-with-activiti with MIT License | 5 votes |
public static MyKeyPair generateKeyPair(){ KeyPair keyPair= SecureUtil.generateKeyPair(SignAlgorithm.SHA1withRSA.getValue(),2048); String priKey= Base64Encoder.encode(keyPair.getPrivate().getEncoded()); String pubkey= Base64Encoder.encode(keyPair.getPublic().getEncoded()); MyKeyPair resp=new MyKeyPair(); resp.setPriKey(priKey); resp.setPubKey(pubkey); return resp; }
Example #7
Source File: SecurityTools.java From teaching with Apache License 2.0 | 5 votes |
public static MyKeyPair generateKeyPair(){ KeyPair keyPair= SecureUtil.generateKeyPair(SignAlgorithm.SHA1withRSA.getValue(),2048); String priKey= Base64Encoder.encode(keyPair.getPrivate().getEncoded()); String pubkey= Base64Encoder.encode(keyPair.getPublic().getEncoded()); MyKeyPair resp=new MyKeyPair(); resp.setPriKey(priKey); resp.setPubKey(pubkey); return resp; }
Example #8
Source File: SecurityTools.java From jeecg-boot with Apache License 2.0 | 5 votes |
public static MyKeyPair generateKeyPair(){ KeyPair keyPair= SecureUtil.generateKeyPair(SignAlgorithm.SHA1withRSA.getValue(),2048); String priKey= Base64Encoder.encode(keyPair.getPrivate().getEncoded()); String pubkey= Base64Encoder.encode(keyPair.getPublic().getEncoded()); MyKeyPair resp=new MyKeyPair(); resp.setPriKey(priKey); resp.setPubKey(pubkey); return resp; }