Code example for PublicKey

Methods: getEncoded

0
        PublicKey pubKey)
        throws InvalidKeyException 
    { 
        try 
        { 
            SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(pubKey.getEncoded());
 
            return (ASN1OctetString)(new SubjectKeyIdentifier(info).toASN1Object());
        } 
        catch (Exception e)
        { 
            throw new InvalidKeyException("Exception extracting key details: " + e.toString());
        } 
    } 
     
    public SubjectKeyIdentifierStructure( 
        PublicKey pubKey)
        throws InvalidKeyException 
    { 
        super(fromPublicKey(pubKey));
    }