Code example for PrivateKey

Methods: getEncoded

0
        else 
        { 
            // see if we can build a key from key.getEncoded() 
            try 
            { 
                byte[] bytes = key.getEncoded();
 
                if (bytes == null)
                { 
                    throw new InvalidKeyException("no encoding for EC private key");
                } 
 
                PrivateKey privateKey = BouncyCastleProvider.getPrivateKey(PrivateKeyInfo.getInstance(bytes));
 
                if (privateKey instanceof java.security.interfaces.ECPrivateKey)
                { 
                    return ECUtil.generatePrivateKeyParameter(privateKey);
                } 
            } 
            catch (Exception e)
            {