All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.spongycastle.asn1.esf.SignaturePolicyIdentifier Maven / Gradle / Ivy

Go to download

Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle intended for Android. Android ships with a stripped-down version of Bouncy Castle - this causes classloader collisions if you try to add an alternative (updated/complete) Bouncy Castle jar. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5.

The newest version!
package org.spongycastle.asn1.esf;

import org.spongycastle.asn1.*;

public class SignaturePolicyIdentifier
    extends ASN1Encodable
{
    private SignaturePolicyId   signaturePolicyId;
    private boolean             isSignaturePolicyImplied;

    public static SignaturePolicyIdentifier getInstance(
        Object  obj)
    {
        if (obj == null || obj instanceof SignaturePolicyIdentifier)
        {
            return (SignaturePolicyIdentifier) obj;
        }
        else if (obj instanceof ASN1Sequence)
        {
            return new SignaturePolicyIdentifier(SignaturePolicyId.getInstance(obj));
        }
        else if (obj instanceof ASN1Null)
        {
            return new SignaturePolicyIdentifier();
        }

        throw new IllegalArgumentException(
                "unknown object in 'SignaturePolicyIdentifier' factory: "
                        + obj.getClass().getName() + ".");
    }

    public SignaturePolicyIdentifier()
    {
        this.isSignaturePolicyImplied = true;
    }

    public SignaturePolicyIdentifier(
        SignaturePolicyId signaturePolicyId)
    {
        this.signaturePolicyId = signaturePolicyId;
        this.isSignaturePolicyImplied = false;
    }

    public SignaturePolicyId getSignaturePolicyId()
    {
        return signaturePolicyId;
    }

    public boolean isSignaturePolicyImplied()
    {
        return isSignaturePolicyImplied;
    }

    /**
     * 
     * SignaturePolicyIdentifier ::= CHOICE{
     *     SignaturePolicyId         SignaturePolicyId,
     *     SignaturePolicyImplied    SignaturePolicyImplied }
     *
     * SignaturePolicyImplied ::= NULL
     * 
*/ public DERObject toASN1Object() { if (isSignaturePolicyImplied) { return new DERNull(); } else { return signaturePolicyId.getDERObject(); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy