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

org.bouncycastle.oer.its.ieee1609dot2.SequenceOfRecipientInfo Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.0.3
Show newest version
package org.bouncycastle.oer.its.ieee1609dot2;

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.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;

/**
 * 
 *     SequenceOfRecipientInfo ::= SEQUENCE OF RecipientInfo
 * 
*/ public class SequenceOfRecipientInfo extends ASN1Object { private final List recipientInfos; public SequenceOfRecipientInfo(List recipientInfos) { this.recipientInfos = Collections.unmodifiableList(recipientInfos); } private SequenceOfRecipientInfo(ASN1Sequence sequence) { ArrayList infoArrayList = new ArrayList(); for (Iterator it = sequence.iterator(); it.hasNext(); ) { infoArrayList.add(RecipientInfo.getInstance(it.next())); } recipientInfos = Collections.unmodifiableList(infoArrayList); } public static SequenceOfRecipientInfo getInstance(Object object) { if (object instanceof SequenceOfRecipientInfo) { return (SequenceOfRecipientInfo)object; } if (object != null) { return new SequenceOfRecipientInfo(ASN1Sequence.getInstance(object)); } return null; } public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); for (RecipientInfo info : recipientInfos) { v.add(info); } return new DERSequence(v); } public List getRecipientInfos() { return recipientInfos; } public static Builder builder() { return new Builder(); } public static class Builder { private List recipientInfos; public Builder setRecipientInfos(List recipientInfos) { this.recipientInfos = recipientInfos; return this; } public Builder addRecipients(RecipientInfo... items) { if (recipientInfos == null) { recipientInfos = new ArrayList(); } recipientInfos.addAll(Arrays.asList(items)); return this; } public SequenceOfRecipientInfo createSequenceOfRecipientInfo() { return new SequenceOfRecipientInfo(recipientInfos); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy