Code example for X509Certificate

Methods: getPublicKey

0
		KeyPair ecKeyPair = RSAKeyPairGenerator.generateRSAKeyPair(1024, RSAKeyGenParameterSpec.F4);
		 
		//when 
		X509Certificate certificate = rsaCertificateCreator.createSelfSignedCertificate(ecKeyPair, "SHA1withRSA");
		RSAPublicKey pairRSAPublicKey = (RSAPublicKey) ecKeyPair.getPublic();
		RSAPublicKey certRSAPublicKey = (RSAPublicKey) certificate.getPublicKey();
		 
		// then 
		Assertions.assertThat(certRSAPublicKey.getModulus()).isEqualTo(pairRSAPublicKey.getModulus());
	} 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE