Example usage for org.bouncycastle.asn1.sec ECPrivateKey getEncoded

List of usage examples for org.bouncycastle.asn1.sec ECPrivateKey getEncoded

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.sec ECPrivateKey getEncoded.

Prototype

public byte[] getEncoded() throws IOException 

Source Link

Document

Return the default BER or DER encoding for this object.

Usage

From source file:edu.tamu.tcat.crypto.bouncycastle.ASN1SeqKeyImpl.java

License:Apache License

private static byte[] encodeECKey(java.security.interfaces.ECPrivateKey key) throws EncodingException {
    ASN1Sequence parameters = getParameters(key.getParams());
    DERBitString publicKey = getPublic(key);
    ECPrivateKey encoded = new ECPrivateKey(key.getS(), publicKey, parameters);
    try {//ww w.  j a  va 2s .co m
        return encoded.getEncoded();
    } catch (IOException e) {
        throw new EncodingException(e);
    }
}