org.bouncycastle.asn1.cmc.ControlsProcessed Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcutil-fips Show documentation
Show all versions of bcutil-fips Show documentation
The Bouncy Castle Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctls 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 and used appropriately.
The newest version!
package org.bouncycastle.asn1.cmc;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
/**
*
* -- Inform follow on servers that one or more controls have already been
* -- processed
*
* id-cmc-controlProcessed OBJECT IDENTIFIER ::= {id-cmc 32}
*
* ControlsProcessed ::= SEQUENCE {
* bodyList SEQUENCE SIZE(1..MAX) OF BodyPartReference
* }
*
*/
public class ControlsProcessed
extends ASN1Object
{
private final ASN1Sequence bodyPartReferences;
/**
* Construct a ControlsProcessed object containing one BodyPartReference.
*
* @param bodyPartRef the BodyPartReference to be contained.
*/
public ControlsProcessed(
BodyPartReference bodyPartRef)
{
this.bodyPartReferences = new DERSequence(bodyPartRef);
}
public ControlsProcessed(
BodyPartReference[] bodyList)
{
this.bodyPartReferences = new DERSequence(bodyList);
}
public static ControlsProcessed getInstance(Object src)
{
if (src instanceof ControlsProcessed)
{
return (ControlsProcessed)src;
}
else if (src != null)
{
return new ControlsProcessed(ASN1Sequence.getInstance(src));
}
return null;
}
private ControlsProcessed(
ASN1Sequence seq)
{
if (seq.size() != 1)
{
throw new IllegalArgumentException("incorrect sequence size");
}
this.bodyPartReferences = ASN1Sequence.getInstance(seq.getObjectAt(0));
}
public BodyPartReference[] getBodyList()
{
BodyPartReference[] tmp = new BodyPartReference[bodyPartReferences.size()];
for (int i = 0; i != bodyPartReferences.size(); i++)
{
tmp[i] = BodyPartReference.getInstance(bodyPartReferences.getObjectAt(i));
}
return tmp;
}
public ASN1Primitive toASN1Primitive()
{
return new DERSequence(bodyPartReferences);
}
}