Example usage for org.bouncycastle.asn1.pkcs DHParameter getInstance

List of usage examples for org.bouncycastle.asn1.pkcs DHParameter getInstance

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.pkcs DHParameter getInstance.

Prototype

public static DHParameter getInstance(Object obj) 

Source Link

Usage

From source file:org.dcache.xrootd.plugins.authn.gsi.DHSession.java

License:Open Source License

/**
 * Creates an DHParameterSpec object from the DER-encoded byte sequence
 * @param der the DER-encoded byte sequence
 * @return the DHParameterSpec object/*from  ww  w  .  j  a  va 2  s. c  o m*/
 * @throws IOException if the deserialisation goes wrong
 */
private static DHParameterSpec fromDER(byte[] der) throws IOException {
    ByteArrayInputStream inStream = new ByteArrayInputStream(der);
    ASN1InputStream derInputStream = new ASN1InputStream(inStream);
    DHParameter dhparam = DHParameter.getInstance(derInputStream.readObject());
    return new DHParameterSpec(dhparam.getP(), dhparam.getG());
}