java 公钥指数 公钥模,如何在RSA公钥RSAPublicKey中获取指数和模
RSAPublicKey中有两个方法getModulus()对应公钥的模数;getPublicExponent()对应公钥的指数;当但这两个值都是BigInteger类型,需要转成String类型;引入maven依赖包:com.nimbusdsnimbus-jose-jwt8.20源代码如下:String pukModule = org.apache.commons.codec.binary.Ba
·
RSAPublicKey中有两个方法getModulus()对应公钥的模数;
getPublicExponent()对应公钥的指数;
当但这两个值都是BigInteger类型,需要转成String类型;
引入maven依赖包:
com.nimbusds
nimbus-jose-jwt
8.20
源代码如下:
String pukModule = org.apache.commons.codec.binary.Base64
.encodeBase64URLSafeString(BigIntegerUtils.toBytesUnsigned(publicKey.getModulus()));
String pukPubExp = org.apache.commons.codec.binary.Base64
.encodeBase64URLSafeString(BigIntegerUtils.toBytesUnsigned(publicKey.getPublicExponent()));
更多推荐



所有评论(0)