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

org.bouncycastle.oer.its.SequenceOfCertificate Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctls. This jar contains APIs for JDK 1.5 and up.

The newest version!
package org.bouncycastle.oer.its;

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;

/**
 * 
 *     SequenceOfCertificate ::= SEQUENCE OF Certificate
 * 
*/ public class SequenceOfCertificate extends ASN1Object { private final List certificates; public SequenceOfCertificate(List certificates) { this.certificates = Collections.unmodifiableList(certificates); } public static SequenceOfCertificate getInstance(Object src) { if (src instanceof SequenceOfCertificate) { return (SequenceOfCertificate)src; } Iterator seq = ASN1Sequence.getInstance(src).iterator(); List certificates = new ArrayList(); while (seq.hasNext()) { certificates.add(Certificate.getInstance(seq.next())); } return new SequenceOfCertificate(certificates); } public static Builder builder() { return new Builder(); } public ASN1Primitive toASN1Primitive() { return Utils.toSequence(certificates); } public List getCertificates() { return certificates; } public static class Builder { List certificates = new ArrayList(); public Builder add(Certificate... certificates) { this.certificates.addAll(Arrays.asList(certificates)); return this; } public SequenceOfCertificate build() { return new SequenceOfCertificate(certificates); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy