update RSA, add public RSA object

This commit is contained in:
tursom 2020-03-02 02:18:17 +08:00
parent 9c473813af
commit 39ed6ad7e3

View File

@ -19,6 +19,14 @@ class RSA(val publicKey: RSAPublicKey, val privateKey: RSAPrivateKey? = null) :
val decryptMaxLen = keySize / 8
val encryptMaxLen = decryptMaxLen - 11
val public by lazy {
if (privateKey == null) {
this
} else {
RSA(publicKey)
}
}
private val encryptCipher = Cipher.getInstance("RSA")!!
private val decryptCipher = Cipher.getInstance("RSA")!!