org.bouncycastle.asn1.x509.qualified.QCStatement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-ext-debug-jdk18on Show documentation
Show all versions of bcprov-ext-debug-jdk18on Show documentation
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for Java 1.8 and later with debug enabled.
The newest version!
package org.bouncycastle.asn1.x509.qualified;
import java.util.Enumeration;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
/**
* The QCStatement object.
*
* QCStatement ::= SEQUENCE {
* statementId OBJECT IDENTIFIER,
* statementInfo ANY DEFINED BY statementId OPTIONAL}
*
*/
public class QCStatement
extends ASN1Object
implements ETSIQCObjectIdentifiers, RFC3739QCObjectIdentifiers
{
ASN1ObjectIdentifier qcStatementId;
ASN1Encodable qcStatementInfo;
public static QCStatement getInstance(
Object obj)
{
if (obj instanceof QCStatement)
{
return (QCStatement)obj;
}
if (obj != null)
{
return new QCStatement(ASN1Sequence.getInstance(obj));
}
return null;
}
private QCStatement(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
// qcStatementId
qcStatementId = ASN1ObjectIdentifier.getInstance(e.nextElement());
// qcstatementInfo
if (e.hasMoreElements())
{
qcStatementInfo = (ASN1Encodable) e.nextElement();
}
}
public QCStatement(
ASN1ObjectIdentifier qcStatementId)
{
this.qcStatementId = qcStatementId;
this.qcStatementInfo = null;
}
public QCStatement(
ASN1ObjectIdentifier qcStatementId,
ASN1Encodable qcStatementInfo)
{
this.qcStatementId = qcStatementId;
this.qcStatementInfo = qcStatementInfo;
}
public ASN1ObjectIdentifier getStatementId()
{
return qcStatementId;
}
public ASN1Encodable getStatementInfo()
{
return qcStatementInfo;
}
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector seq = new ASN1EncodableVector(2);
seq.add(qcStatementId);
if (qcStatementInfo != null)
{
seq.add(qcStatementInfo);
}
return new DERSequence(seq);
}
}