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

org.bouncycastle.asn1.cmp.CertReqTemplateContent 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.4.

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

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;
import org.bouncycastle.asn1.crmf.CertTemplate;

/**
 * GenMsg:    {id-it 19}, < absent >
 * GenRep:    {id-it 19}, CertReqTemplateContent | < absent >
 * 

* CertReqTemplateValue ::= CertReqTemplateContent *

* CertReqTemplateContent ::= SEQUENCE { * certTemplate CertTemplate, * keySpec Controls OPTIONAL } *

* Controls ::= SEQUENCE SIZE (1..MAX) OF AttributeTypeAndValue */ public class CertReqTemplateContent extends ASN1Object { private final CertTemplate certTemplate; private final ASN1Sequence keySpec; private CertReqTemplateContent(ASN1Sequence seq) { if (seq.size() != 1 && seq.size() != 2) { throw new IllegalArgumentException("expected sequence size of 1 or 2"); } certTemplate = CertTemplate.getInstance(seq.getObjectAt(0)); if (seq.size() > 1) { keySpec = ASN1Sequence.getInstance(seq.getObjectAt(1)); } else { keySpec = null; } } public CertReqTemplateContent(CertTemplate certTemplate, ASN1Sequence keySpec) { this.certTemplate = certTemplate; this.keySpec = keySpec; } public static CertReqTemplateContent getInstance(Object o) { if (o instanceof CertReqTemplateContent) { return (CertReqTemplateContent)o; } else if (o != null) { return new CertReqTemplateContent(ASN1Sequence.getInstance(o)); } return null; } public CertTemplate getCertTemplate() { return certTemplate; } public ASN1Sequence getKeySpec() { return keySpec; } public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(certTemplate); if (keySpec != null) { v.add(keySpec); } return new DERSequence(v); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy