private PublicKey createPublicKey ( String cert ) { try { CertificateFactory fact = CertificateFactory . getInstance ( "X.509" ) ; InputStream stream = new ByteArrayInputStream ( cert . getBytes ( Charset . forName ( "UTF-8" ) ) ) ; X509Certificate cer = ( X509Certificate ) fact . generateCertificate ( stream ) ; validateCertificate ( cer ) ; return cer . getPublicKey ( ) ; } catch ( SdkBaseException e ) { throw e ; } catch ( Exception e ) { throw new SdkClientException ( "Could not create public key from certificate" , e ) ; } }
Build a PublicKey object from a cert