org.bouncycastle.asn1.bc.ObjectDataSequence Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-jdk14 Show documentation
Show all versions of bcprov-jdk14 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 JDK 1.4.
package org.bouncycastle.asn1.bc;
import java.util.Iterator;
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;
import org.bouncycastle.util.Arrays;
/**
*
* ObjectDataSequence ::= SEQUENCE OF ObjectData
*
*/
public class ObjectDataSequence
extends ASN1Object
implements org.bouncycastle.util.Iterable
{
private final ASN1Encodable[] dataSequence;
public ObjectDataSequence(ObjectData[] dataSequence)
{
this.dataSequence = new ASN1Encodable[dataSequence.length];
System.arraycopy(dataSequence, 0, this.dataSequence, 0, dataSequence.length);
}
private ObjectDataSequence(ASN1Sequence seq)
{
dataSequence = new ASN1Encodable[seq.size()];
for (int i = 0; i != dataSequence.length; i++)
{
dataSequence[i] = ObjectData.getInstance(seq.getObjectAt(i));
}
}
public static ObjectDataSequence getInstance(
Object obj)
{
if (obj instanceof ObjectDataSequence)
{
return (ObjectDataSequence)obj;
}
else if (obj != null)
{
return new ObjectDataSequence(ASN1Sequence.getInstance(obj));
}
return null;
}
public ASN1Primitive toASN1Primitive()
{
return new DERSequence(dataSequence);
}
public Iterator iterator()
{
return new Arrays.Iterator (dataSequence);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy