Search in sources :

Example 1 with ASN1TaggedObjectParser

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

the class AuthEnvelopedDataParser method getOriginatorInfo.

public OriginatorInfo getOriginatorInfo() throws IOException {
    originatorInfoCalled = true;
    if (nextObject == null) {
        nextObject = seq.readObject();
    }
    if (nextObject instanceof ASN1TaggedObjectParser) {
        ASN1TaggedObjectParser o = (ASN1TaggedObjectParser) nextObject;
        if (o.hasContextTag(0)) {
            ASN1SequenceParser originatorInfo = (ASN1SequenceParser) o.parseBaseUniversal(false, BERTags.SEQUENCE);
            nextObject = null;
            return OriginatorInfo.getInstance(originatorInfo.getLoadedObject());
        }
    }
    return null;
}
Also used : ASN1SequenceParser(com.github.zhenwei.core.asn1.ASN1SequenceParser) ASN1TaggedObjectParser(com.github.zhenwei.core.asn1.ASN1TaggedObjectParser)

Example 2 with ASN1TaggedObjectParser

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

the class AuthenticatedDataParser method getOriginatorInfo.

public OriginatorInfo getOriginatorInfo() throws IOException {
    originatorInfoCalled = true;
    if (nextObject == null) {
        nextObject = seq.readObject();
    }
    if (nextObject instanceof ASN1TaggedObjectParser) {
        ASN1TaggedObjectParser o = (ASN1TaggedObjectParser) nextObject;
        if (o.hasContextTag(0)) {
            ASN1SequenceParser originatorInfo = (ASN1SequenceParser) o.parseBaseUniversal(false, BERTags.SEQUENCE);
            nextObject = null;
            return OriginatorInfo.getInstance(originatorInfo.getLoadedObject());
        }
    }
    return null;
}
Also used : ASN1SequenceParser(com.github.zhenwei.core.asn1.ASN1SequenceParser) ASN1TaggedObjectParser(com.github.zhenwei.core.asn1.ASN1TaggedObjectParser)

Example 3 with ASN1TaggedObjectParser

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

the class AuthenticatedDataParser method getDigestAlgorithm.

public AlgorithmIdentifier getDigestAlgorithm() throws IOException {
    if (nextObject == null) {
        nextObject = seq.readObject();
    }
    if (nextObject instanceof ASN1TaggedObjectParser) {
        AlgorithmIdentifier obj = AlgorithmIdentifier.getInstance((ASN1TaggedObject) nextObject.toASN1Primitive(), false);
        nextObject = null;
        return obj;
    }
    return null;
}
Also used : ASN1TaggedObjectParser(com.github.zhenwei.core.asn1.ASN1TaggedObjectParser) AlgorithmIdentifier(com.github.zhenwei.core.asn1.x509.AlgorithmIdentifier)

Example 4 with ASN1TaggedObjectParser

use of com.github.zhenwei.core.asn1.ASN1TaggedObjectParser 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 5 with ASN1TaggedObjectParser

use of com.github.zhenwei.core.asn1.ASN1TaggedObjectParser 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)

Aggregations

ASN1TaggedObjectParser (com.github.zhenwei.core.asn1.ASN1TaggedObjectParser)10 ASN1SetParser (com.github.zhenwei.core.asn1.ASN1SetParser)6 ASN1SequenceParser (com.github.zhenwei.core.asn1.ASN1SequenceParser)3 ASN1ParsingException (com.github.zhenwei.core.asn1.ASN1ParsingException)1 AlgorithmIdentifier (com.github.zhenwei.core.asn1.x509.AlgorithmIdentifier)1 IOException (java.io.IOException)1