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

org.bouncycastle.est.CsrAttrs Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.0.7
Show newest version
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