cert: Certificate
val keyFact = KeyFactory.getInstance(cert.publicKey.algorithm)
var prime: BigInteger? = null
if ("RSA" == cert.publicKey.algorithm) { // 如果是RSA加密
val keySpec = keyFact.getKeySpec(cert.publicKey, RSAPublicKeySpec::class.java) as RSAPublicKeySpec
prime = keySpec.modulus
Log.e(TAG, "size"+prime.toString(2).length)
}
转载于:https://my.oschina.net/zdglf/blog/3040279