LocalCipher.init(Cipher.ENCRYPT_MODE, localPrivateKey) PrivateKey localPrivateKey = KeyFactory.getInstance("RSA").generatePrivate(localPKCS8EncodedKeySpec) īyte hash = MessageDigest.getInstance("SHA-256").digest("test".getBytes()) Ĭipher localCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding") PKCS8EncodedKeySpec localPKCS8EncodedKeySpec = new PKCS8EncodedKeySpec(code(deviceKey).getBytes("UTF-8")) String deviceKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASC." The reason I need to do it with private key is, I need to get the same results as from a Java program not written by me, which wrongly uses and private key to sign messages. I want to make RSA encryption with private key (not normal signing), but P圜ryptodome seems not be able to do it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |