Code example for RSAPublicKey

Methods: getModulusgetPublicExponent

0
	public void testRecoverKeyPair_Rsa() throws Exception { 
		KeyPair kp = PubkeyUtils.recoverKeyPair(RSA_KEY_PKCS8);
 
		RSAPublicKey pubKey = (RSAPublicKey) kp.getPublic();
 
		assertEquals(RSA_KEY_N, pubKey.getModulus());
		assertEquals(RSA_KEY_E, pubKey.getPublicExponent());
	} 
 
	public void testRecoverKeyPair_Ec() throws Exception { 
		KeyPair kp = PubkeyUtils.recoverKeyPair(EC_KEY_PKCS8);
 
		ECPublicKey pubKey = (ECPublicKey) kp.getPublic();
 
		assertEquals(EC_KEY_pub_x, pubKey.getW().getAffineX());
		assertEquals(EC_KEY_pub_y, pubKey.getW().getAffineY());
	} 
 
	private static class MyPrivateKey implements PrivateKey {
		public String getAlgorithm() {
Contextual code suggestions in your IDE  Get Codota for Java