org.bouncycastle.oer.its.etsi102941.SequenceOfCtlCommand 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.
package org.bouncycastle.oer.its.etsi102941;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
public class SequenceOfCtlCommand
extends ASN1Object
{
private final List ctlCommands;
public SequenceOfCtlCommand(List hashedId8s)
{
this.ctlCommands = Collections.unmodifiableList(hashedId8s);
}
private SequenceOfCtlCommand(ASN1Sequence sequence)
{
List items = new ArrayList();
for (Iterator it = sequence.iterator(); it.hasNext(); )
{
items.add(CtlCommand.getInstance(it.next()));
}
this.ctlCommands = Collections.unmodifiableList(items);
}
public static Builder builder()
{
return new Builder();
}
public static SequenceOfCtlCommand getInstance(Object o)
{
if (o instanceof SequenceOfCtlCommand)
{
return (SequenceOfCtlCommand)o;
}
if (o != null)
{
return new SequenceOfCtlCommand(ASN1Sequence.getInstance(o));
}
return null;
}
public List getCtlCommands()
{
return ctlCommands;
}
@Override
public ASN1Primitive toASN1Primitive()
{
return new DERSequence(ctlCommands.toArray(new ASN1Encodable[0]));
}
public static class Builder
{
private final List items = new ArrayList();
public Builder addHashId8(CtlCommand... items)
{
this.items.addAll(Arrays.asList(items));
return this;
}
public SequenceOfCtlCommand build()
{
return new SequenceOfCtlCommand(items);
}
}
}