// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.asn1.cmc;

import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1Object;

public class PKIResponse extends ASN1Object
{
    public static final TaggedContentInfo[] EMPTY_CMS_SEQUENCE;
    public static final OtherMsg[] EMPTY_OTHER_MSG;
    private final ASN1Sequence controlSequence;
    private final ASN1Sequence cmsSequence;
    private final ASN1Sequence otherMsgSequence;
    
    private PKIResponse(final ASN1Sequence asn1Sequence) {
        if (asn1Sequence.size() != 3) {
            throw new IllegalArgumentException("incorrect sequence size");
        }
        this.controlSequence = ASN1Sequence.getInstance(asn1Sequence.getObjectAt(0));
        this.cmsSequence = ASN1Sequence.getInstance(asn1Sequence.getObjectAt(1));
        this.otherMsgSequence = ASN1Sequence.getInstance(asn1Sequence.getObjectAt(2));
    }
    
    public static PKIResponse getInstance(final Object o) {
        if (o instanceof PKIResponse) {
            return (PKIResponse)o;
        }
        if (o != null) {
            return new PKIResponse(ASN1Sequence.getInstance(o));
        }
        return null;
    }
    
    public static PKIResponse getInstance(final ASN1TaggedObject asn1TaggedObject, final boolean b) {
        return getInstance(ASN1Sequence.getInstance(asn1TaggedObject, b));
    }
    
    public PKIResponse(final TaggedAttribute taggedAttribute) {
        this.controlSequence = new DERSequence(taggedAttribute);
        this.cmsSequence = new DERSequence();
        this.otherMsgSequence = new DERSequence();
    }
    
    public PKIResponse(final TaggedAttribute[] array, final TaggedContentInfo[] array2, final OtherMsg[] array3) {
        this.controlSequence = new DERSequence(array);
        this.cmsSequence = new DERSequence(array2);
        this.otherMsgSequence = new DERSequence(array3);
    }
    
    @Override
    public ASN1Primitive toASN1Primitive() {
        final ASN1EncodableVector asn1EncodableVector = new ASN1EncodableVector(3);
        asn1EncodableVector.add(this.controlSequence);
        asn1EncodableVector.add(this.cmsSequence);
        asn1EncodableVector.add(this.otherMsgSequence);
        return new DERSequence(asn1EncodableVector);
    }
    
    public ASN1Sequence getControlSequence() {
        return this.controlSequence;
    }
    
    public ASN1Sequence getCmsSequence() {
        return this.cmsSequence;
    }
    
    public ASN1Sequence getOtherMsgSequence() {
        return this.otherMsgSequence;
    }
    
    static {
        EMPTY_CMS_SEQUENCE = new TaggedContentInfo[0];
        EMPTY_OTHER_MSG = new OtherMsg[0];
    }
}
