简体   繁体   中英

I have modulus and exponent with me how can I create public key in java or java script?

Help me to solve this whether I need to install any package I need to use that public key for load test. Creation of public is not working in jmeter.

exp:10001 modulus:0086fa9ba066685845fc03833a9699c8baefb53cfbf19052a7f10f1eaa30488cec1ceb752bdff2df9fad6c64b3498956e7dbab4035b4823c99a44cc57088a23783

If you're talking about client-side certificates - public key alone is not sufficient because you need a certificate in order to establish a trust

If you want to generate a public key from the modulus/exponent combination for whatever else reason - you can do this using a suitableJSR223 Test Element and Groovy language , example code:

def modulus = new BigInteger('0086fa9ba066685845fc03833a9699c8baefb53cfbf19052a7f10f1eaa30488cec1ceb752bdff2df9fad6c64b3498956e7dbab4035b4823c99a44cc57088a23783', 16)
def exponent = new BigInteger('10001', 16)

def spec = new java.security.spec.RSAPublicKeySpec(modulus, exponent)
def factory = java.security.KeyFactory.getInstance('RSA')
def pub = factory.generatePublic(spec)

log.info('Public key: ' + pub.getEncoded().encodeBase64().toString())

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM