您好,今天怡怡来为大家解答以上的问题。16进制加密相信很多小伙伴还不知道,现在让我们一起来看看吧!
1、ja加密方法如下:Ja codeString modeHex = "D548C6267CC503F1E926776A97F8644CAA67167E8FA5D74FD1F4E0BCB3608BD1583E41B102B5B4617E53B90A0C67EA652F8D96B40CFDDA6BC1501432ADCE15E4B5B6568893C94FF3CAC5ED5942FC604BAD1B12DF7683B25C6702BD8CF1BE2F5A4FFC97C82E42FDE49A6EFF379F5F022F36E5395D64FC9430EEFCAC55F0A5";String exponentHex = "10001";KeyFactory factory = KeyFactory.getInstance("RSA");BigInteger n = new BigInteger(modeHex, 16);BigInteger e = new BigInteger(exponentHex, 16);RSAPublicKeySpec spec = new RSAPublicKeySpec(n, e);RSAPublicKey pub = (RSAPublicKey) factory.generatePublic(spec);Cipher enc = Cipher.getInstance("RSA");enc.init(Cipher.ENCRYPT_MODE, pub);byte[] encryptedContentKey = enc.doFinal(messageg.getBytes("GB2312"));String result = new String(Hex.encodeHex(encryptedContentKey));ja加密方法如下:Ja codeString modeHex = "D548C6267CC503F1E926776A97F8644CAA67167E8FA5D74FD1F4E0BCB3608BD1583E41B102B5B4617E53B90A0C67EA652F8D96B40CFDDA6BC1501432ADCE15E4B5B6568893C94FF3CAC5ED5942FC604BAD1B12DF7683B25C6702BD8CF1BE2F5A4FFC97C82E42FDE49A6EFF379F5F022F36E5395D64FC9430EEFCAC55F0A5";String exponentHex = "10001";KeyFactory factory = KeyFactory.getInstance("RSA");BigInteger n = new BigInteger(modeHex, 16);BigInteger e = new BigInteger(exponentHex, 16);RSAPublicKeySpec spec = new RSAPublicKeySpec(n, e);RSAPublicKey pub = (RSAPublicKey) factory.generatePublic(spec);Cipher enc = Cipher.getInstance("RSA");enc.init(Cipher.ENCRYPT_MODE, pub);byte[] encryptedContentKey = enc.doFinal(messageg.getBytes("GB2312"));String result = new String(Hex.encodeHex(encryptedContentKey));ja加密方法如下:ja加密方法如下:Ja codeString modeHex = "D548C6267CC503F1E926776A97F8644CAA67167E8FA5D74FD1F4E0BCB3608BD1583E41B102B5B4617E53B90A0C67EA652F8D96B40CFDDA6BC1501432ADCE15E4B5B6568893C94FF3CAC5ED5942FC604BAD1B12DF7683B25C6702BD8CF1BE2F5A4FFC97C82E42FDE49A6EFF379F5F022F36E5395D64FC9430EEFCAC55F0A5";String exponentHex = "10001";KeyFactory factory = KeyFactory.getInstance("RSA");BigInteger n = new BigInteger(modeHex, 16);BigInteger e = new BigInteger(exponentHex, 16);RSAPublicKeySpec spec = new RSAPublicKeySpec(n, e);RSAPublicKey pub = (RSAPublicKey) factory.generatePublic(spec);Cipher enc = Cipher.getInstance("RSA");enc.init(Cipher.ENCRYPT_MODE, pub);byte[] encryptedContentKey = enc.doFinal(messageg.getBytes("GB2312"));String result = new String(Hex.encodeHex(encryptedContentKey));Ja codeString modeHex = "D548C6267CC503F1E926776A97F8644CAA67167E8FA5D74FD1F4E0BCB3608BD1583E41B102B5B4617E53B90A0C67EA652F8D96B40CFDDA6BC1501432ADCE15E4B5B6568893C94FF3CAC5ED5942FC604BAD1B12DF7683B25C6702BD8CF1BE2F5A4FFC97C82E42FDE49A6EFF379F5F022F36E5395D64FC9430EEFCAC55F0A5";String exponentHex = "10001";KeyFactory factory = KeyFactory.getInstance("RSA");BigInteger n = new BigInteger(modeHex, 16);BigInteger e = new BigInteger(exponentHex, 16);RSAPublicKeySpec spec = new RSAPublicKeySpec(n, e);RSAPublicKey pub = (RSAPublicKey) factory.generatePublic(spec);Cipher enc = Cipher.getInstance("RSA");enc.init(Cipher.ENCRYPT_MODE, pub);byte[] encryptedContentKey = enc.doFinal(messageg.getBytes("GB2312"));String result = new String(Hex.encodeHex(encryptedContentKey));ja加密方法如下:Ja codeString modeHex = "D548C6267CC503F1E926776A97F8644CAA67167E8FA5D74FD1F4E0BCB3608BD1583E41B102B5B4617E53B90A0C67EA652F8D96B40CFDDA6BC1501432ADCE15E4B5B6568893C94FF3CAC5ED5942FC604BAD1B12DF7683B25C6702BD8CF1BE2F5A4FFC97C82E42FDE49A6EFF379F5F022F36E5395D64FC9430EEFCAC55F0A5";String exponentHex = "10001";KeyFactory factory = KeyFactory.getInstance("RSA");BigInteger n = new BigInteger(modeHex, 16);BigInteger e = new BigInteger(exponentHex, 16);RSAPublicKeySpec spec = new RSAPublicKeySpec(n, e);RSAPublicKey pub = (RSAPublicKey) factory.generatePublic(spec);Cipher enc = Cipher.getInstance("RSA");enc.init(Cipher.ENCRYPT_MODE, pub);byte[] encryptedContentKey = enc.doFinal(messageg.getBytes("GB2312"));String result = new String(Hex.encodeHex(encryptedContentKey));ja加密方法如下:Ja codeString modeHex = "D548C6267CC503F1E926776A97F8644CAA67167E8FA5D74FD1F4E0BCB3608BD1583E41B102B5B4617E53B90A0C67EA652F8D96B40CFDDA6BC1501432ADCE15E4B5B6568893C94FF3CAC5ED5942FC604BAD1B12DF7683B25C6702BD8CF1BE2F5A4FFC97C82E42FDE49A6EFF379F5F022F36E5395D64FC9430EEFCAC55F0A5";String exponentHex = "10001";KeyFactory factory = KeyFactory.getInstance("RSA");BigInteger n = new BigInteger(modeHex, 16);BigInteger e = new BigInteger(exponentHex, 16);RSAPublicKeySpec spec = new RSAPublicKeySpec(n, e);RSAPublicKey pub = (RSAPublicKey) factory.generatePublic(spec);Cipher enc = Cipher.getInstance("RSA");enc.init(Cipher.ENCRYPT_MODE, pub);byte[] encryptedContentKey = enc.doFinal(messageg.getBytes("GB2312"));String result = new String(Hex.encodeHex(encryptedContentKey));。
本文到这结束,希望上面文章对大家有所帮助。
版权声明:本文内容由互联。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发 836084111@qq.com 邮箱删除。