org.bouncycastle.est.CsrAttrs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpkix-fips Show documentation
Show all versions of bcpkix-fips Show documentation
The Bouncy Castle Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation. The APIs are designed primarily to be used in conjunction with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified.
package org.bouncycastle.est;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERSequence;
/**
*
* CsrAttrs ::= SEQUENCE SIZE (0..MAX) OF AttrOrOID
*
*/
public class CsrAttrs
extends ASN1Object
{
private final AttrOrOID[] attrOrOIDs;
public static CsrAttrs getInstance(
Object obj)
{
if (obj instanceof CsrAttrs)
{
return (CsrAttrs)obj;
}
if (obj != null)
{
return new CsrAttrs(ASN1Sequence.getInstance(obj));
}
return null;
}
public static CsrAttrs getInstance(
ASN1TaggedObject obj,
boolean explicit)
{
return getInstance(ASN1Sequence.getInstance(obj, explicit));
}
/**
* Construct a CsrAttrs object containing one AttrOrOID.
*
* @param attrOrOID the AttrOrOID to be contained.
*/
public CsrAttrs(
AttrOrOID attrOrOID)
{
this.attrOrOIDs = new AttrOrOID[]{attrOrOID};
}
public CsrAttrs(
AttrOrOID[] attrOrOIDs)
{
this.attrOrOIDs = Utils.clone(attrOrOIDs);
}
private CsrAttrs(
ASN1Sequence seq)
{
this.attrOrOIDs = new AttrOrOID[seq.size()];
for (int i = 0; i != seq.size(); i++)
{
attrOrOIDs[i] = AttrOrOID.getInstance(seq.getObjectAt(i));
}
}
public AttrOrOID[] getAttrOrOIDs()
{
return Utils.clone(attrOrOIDs);
}
public int size()
{
return attrOrOIDs.length;
}
public ASN1Primitive toASN1Primitive()
{
return new DERSequence(attrOrOIDs);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy