Search in sources :

Example 6 with ASN1SetParser

use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.

the class CMSEnvelopedDataParser method getUnprotectedAttributes.

/**
 * return a table of the unprotected attributes indexed by the OID of the attribute.
 *
 * @throws IOException
 */
public AttributeTable getUnprotectedAttributes() throws IOException {
    if (unprotectedAttributes == null && attrNotRead) {
        ASN1SetParser set = envelopedData.getUnprotectedAttrs();
        attrNotRead = false;
        if (set != null) {
            ASN1EncodableVector v = new ASN1EncodableVector();
            ASN1Encodable o;
            while ((o = set.readObject()) != null) {
                ASN1SequenceParser seq = (ASN1SequenceParser) o;
                v.add(seq.toASN1Primitive());
            }
            unprotectedAttributes = new AttributeTable(new DERSet(v));
        }
    }
    return unprotectedAttributes;
}
Also used : ASN1SequenceParser(com.github.zhenwei.core.asn1.ASN1SequenceParser) ASN1SetParser(com.github.zhenwei.core.asn1.ASN1SetParser) AttributeTable(com.github.zhenwei.pkix.util.asn1.cms.AttributeTable) ASN1EncodableVector(com.github.zhenwei.core.asn1.ASN1EncodableVector) ASN1Encodable(com.github.zhenwei.core.asn1.ASN1Encodable) DERSet(com.github.zhenwei.core.asn1.DERSet)

Example 7 with ASN1SetParser

use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.

the class AuthEnvelopedDataParser method getRecipientInfos.

public ASN1SetParser getRecipientInfos() throws IOException {
    if (!originatorInfoCalled) {
        getOriginatorInfo();
    }
    if (nextObject == null) {
        nextObject = seq.readObject();
    }
    ASN1SetParser recipientInfos = (ASN1SetParser) nextObject;
    nextObject = null;
    return recipientInfos;
}
Also used : ASN1SetParser(com.github.zhenwei.core.asn1.ASN1SetParser)

Example 8 with ASN1SetParser

use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.

the class AuthEnvelopedDataParser method getAuthAttrs.

public ASN1SetParser getAuthAttrs() throws IOException {
    if (nextObject == null) {
        nextObject = seq.readObject();
    }
    if (nextObject instanceof ASN1TaggedObjectParser) {
        ASN1TaggedObjectParser o = (ASN1TaggedObjectParser) nextObject;
        nextObject = null;
        return (ASN1SetParser) ASN1Util.parseContextBaseUniversal(o, 1, false, BERTags.SET_OF);
    }
    // EncryptedContentInfo is not id-data."
    if (!isData) {
        throw new ASN1ParsingException("authAttrs must be present with non-data content");
    }
    return null;
}
Also used : ASN1TaggedObjectParser(com.github.zhenwei.core.asn1.ASN1TaggedObjectParser) ASN1ParsingException(com.github.zhenwei.core.asn1.ASN1ParsingException) ASN1SetParser(com.github.zhenwei.core.asn1.ASN1SetParser)

Example 9 with ASN1SetParser

use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.

the class AuthEnvelopedDataParser method getUnauthAttrs.

public ASN1SetParser getUnauthAttrs() throws IOException {
    if (nextObject == null) {
        nextObject = seq.readObject();
    }
    if (nextObject != null) {
        ASN1TaggedObjectParser o = (ASN1TaggedObjectParser) nextObject;
        nextObject = null;
        return (ASN1SetParser) ASN1Util.parseContextBaseUniversal(o, 2, false, BERTags.SET_OF);
    }
    return null;
}
Also used : ASN1TaggedObjectParser(com.github.zhenwei.core.asn1.ASN1TaggedObjectParser) ASN1SetParser(com.github.zhenwei.core.asn1.ASN1SetParser)

Example 10 with ASN1SetParser

use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.

the class AuthenticatedDataParser method getAuthAttrs.

public ASN1SetParser getAuthAttrs() throws IOException {
    if (nextObject == null) {
        nextObject = seq.readObject();
    }
    if (nextObject instanceof ASN1TaggedObjectParser) {
        ASN1TaggedObjectParser o = (ASN1TaggedObjectParser) nextObject;
        nextObject = null;
        return (ASN1SetParser) ASN1Util.parseContextBaseUniversal(o, 2, false, BERTags.SET_OF);
    }
    return null;
}
Also used : ASN1TaggedObjectParser(com.github.zhenwei.core.asn1.ASN1TaggedObjectParser) ASN1SetParser(com.github.zhenwei.core.asn1.ASN1SetParser)

Aggregations

ASN1SetParser (com.github.zhenwei.core.asn1.ASN1SetParser)14 ASN1TaggedObjectParser (com.github.zhenwei.core.asn1.ASN1TaggedObjectParser)6 ASN1Encodable (com.github.zhenwei.core.asn1.ASN1Encodable)3 ASN1EncodableVector (com.github.zhenwei.core.asn1.ASN1EncodableVector)2 ASN1SequenceParser (com.github.zhenwei.core.asn1.ASN1SequenceParser)2 DERSet (com.github.zhenwei.core.asn1.DERSet)2 AttributeTable (com.github.zhenwei.pkix.util.asn1.cms.AttributeTable)2 IOException (java.io.IOException)2 ASN1ParsingException (com.github.zhenwei.core.asn1.ASN1ParsingException)1 ASN1TaggedObject (com.github.zhenwei.core.asn1.ASN1TaggedObject)1 BERTaggedObject (com.github.zhenwei.core.asn1.BERTaggedObject)1 DERTaggedObject (com.github.zhenwei.core.asn1.DERTaggedObject)1 SignerInfo (com.github.zhenwei.pkix.util.asn1.cms.SignerInfo)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1