-
-
Save rsatrio/81f243924432947e9dd2239f8e6a3408 to your computer and use it in GitHub Desktop.
Getting Public Key in CMS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Getting PublicKey | |
Collection<X509CertificateHolder> matches = signedData.getCertificates().getMatches(signerInfo.getSID()); | |
byte[] pubByte=matches.iterator().next().getSubjectPublicKeyInfo().getEncoded(); | |
X509EncodedKeySpec keySpec=new X509EncodedKeySpec(pubByte); | |
KeyFactory kf = KeyFactory.getInstance("RSA"); | |
PublicKey pubKey=kf.generatePublic(keySpec); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment