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

org.bouncycastle.asn1.cmp.CRLSource 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 Java 8 and later.

There is a newer version: 2.73.6
Show newest version
package org.bouncycastle.asn1.cmp;

import org.bouncycastle.asn1.ASN1Choice;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.asn1.x509.DistributionPointName;
import org.bouncycastle.asn1.x509.GeneralNames;

/**
 * GenMsg:    {id-it TBD1}, SEQUENCE SIZE (1..MAX) OF CRLStatus
 * GenRep:    {id-it TBD2}, SEQUENCE SIZE (1..MAX) OF
 * CertificateList  |  < absent >
 * 

* CRLSource ::= CHOICE { * dpn [0] DistributionPointName, * issuer [1] GeneralNames } *

*/ public class CRLSource extends ASN1Object implements ASN1Choice { private final DistributionPointName dpn; private final GeneralNames issuer; private CRLSource(ASN1TaggedObject ato) { switch (ato.getTagNo()) { case 0: dpn = DistributionPointName.getInstance(ato, true); issuer = null; break; case 1: dpn = null; issuer = GeneralNames.getInstance(ato, true); break; default: throw new IllegalArgumentException("unknown tag " + ato.getTagNo()); } } public CRLSource(DistributionPointName dpn, GeneralNames issuer) { if ((dpn == null) == (issuer == null)) { throw new IllegalArgumentException("either dpn or issuer must be set"); } this.dpn = dpn; this.issuer = issuer; } public static CRLSource getInstance(Object o) { if (o instanceof CRLSource) { return (CRLSource)o; } if (o != null) { return new CRLSource(ASN1TaggedObject.getInstance(o)); } return null; } public DistributionPointName getDpn() { return dpn; } public GeneralNames getIssuer() { return issuer; } public ASN1Primitive toASN1Primitive() { if (dpn != null) { return new DERTaggedObject(true, 0, dpn); } return new DERTaggedObject(true, 1, issuer); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy