Example usage for org.bouncycastle.asn1 ASN1Sequence getEncoded

List of usage examples for org.bouncycastle.asn1 ASN1Sequence getEncoded

Introduction

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

Prototype

public byte[] getEncoded(String encoding) throws IOException 

Source Link

Document

Return either the default for "BER" or a DER encoding if "DER" is specified.

Usage

From source file:eu.europa.ec.markt.dss.DSSASN1Utils.java

License:Open Source License

public static byte[] getEncoded(final ASN1Sequence signPolicyInfo) throws DSSException {

    try {//w ww. j av  a 2  s. c om
        return signPolicyInfo.getEncoded(ASN1Encoding.DER);
    } catch (IOException e) {
        throw new DSSException(e);
    }
}

From source file:org.jmrtd.lds.SignedDataUtil.java

License:Open Source License

public static void writeData(SignedData signedData, OutputStream outputStream) throws IOException {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(new ASN1ObjectIdentifier(SignedDataUtil.RFC_3369_SIGNED_DATA_OID));
    v.add(new DERTaggedObject(0, signedData));
    ASN1Sequence fileContentsObject = new DLSequence(v);
    byte[] fileContentsBytes = fileContentsObject.getEncoded(ASN1Encoding.DER);
    outputStream.write(fileContentsBytes);
}

From source file:org.jruby.ext.openssl.X509Request.java

License:LGPL

@JRubyMethod
public RubyString to_der() {
    final ASN1Sequence seq = getRequest().toASN1Structure();
    try {//w  ww. j  a va2 s .  c o m
        return StringHelper.newString(getRuntime(), seq.getEncoded(ASN1Encoding.DER));
    } catch (IOException ex) {
        throw getRuntime().newIOErrorFromException(ex);
    }
}