Example usage for org.bouncycastle.asn1 DERTaggedObject getObjectParser

List of usage examples for org.bouncycastle.asn1 DERTaggedObject getObjectParser

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 DERTaggedObject getObjectParser.

Prototype

public ASN1Encodable getObjectParser(int tag, boolean isExplicit) throws IOException 

Source Link

Document

Return the object held in this tagged object as a parser assuming it has the type of the passed in tag.

Usage

From source file:de.fraunhofer.fokus.openeid.pace.PaceECDH.java

License:Open Source License

public byte[] parseGetPointResponse(byte[] response) throws IOException {
    DERApplicationSpecific dataObject = (DERApplicationSpecific) DERApplicationSpecific.fromByteArray(response);
    ASN1Sequence sequence = ASN1Sequence.getInstance(dataObject.getObject(DERTags.SEQUENCE));
    DERTaggedObject tagged = (DERTaggedObject) sequence.getObjectAt(0);
    DEROctetString octetString = (DEROctetString) tagged.getObjectParser(DERTags.OCTET_STRING, false);
    return octetString.getOctets();
}

From source file:de.fraunhofer.fokus.openeid.structure.SequenceData.java

License:Open Source License

/**
 * TaggedObject with value only (OctetString),
 * then the OctetString is retrieved/*w w w . j  a  v  a 2  s . c om*/
 * @param tagged
 * @return byte array representation of the retrieved content
 */
public static byte[] getContent(DERTaggedObject tagged) {
    if (tagged != null) {
        DEREncodable objectParser = tagged.getObjectParser(DERTags.TAGGED, true);
        DEROctetString inner = (DEROctetString) objectParser;
        return inner.getOctets();
    } else {
        return new byte[0];
    }
}

From source file:de.tsenger.animamea.asn1.DynamicAuthenticationData.java

License:Open Source License

/**
 * Liefert den Inhalt des Tagged Objects mit dem Tag (0x80 & tagno) zurck.
 * @param tagno/*from  ww w .  j  a  v  a2 s.  c o m*/
 * @return
 */
public byte[] getDataObject(int tagno) {
    for (DERTaggedObject item : objects) {
        if (item.getTagNo() == tagno) {
            DEROctetString ostr = (DEROctetString) item.getObjectParser(BERTags.OCTET_STRING, false);
            return ostr.getOctets();
        }
    }
    return null;
}