CrlID.java
资源名称:security.rar [点击查看]
上传用户:lior1029
上传日期:2013-05-07
资源大小:209k
文件大小:2k
源码类别:
CA认证
开发平台:
Java
- package org.bouncycastle.asn1.ocsp;
- import java.util.Enumeration;
- import org.bouncycastle.asn1.ASN1Sequence;
- import org.bouncycastle.asn1.ASN1TaggedObject;
- import org.bouncycastle.asn1.DERIA5String;
- import org.bouncycastle.asn1.DERObject;
- import org.bouncycastle.asn1.DERInteger;
- import org.bouncycastle.asn1.DERSequence;
- import org.bouncycastle.asn1.DERTaggedObject;
- import org.bouncycastle.asn1.DEREncodable;
- import org.bouncycastle.asn1.ASN1EncodableVector;
- import org.bouncycastle.asn1.DERGeneralizedTime;
- public class CrlID
- implements DEREncodable
- {
- DERIA5String crlUrl;
- DERInteger crlNum;
- DERGeneralizedTime crlTime;
- public CrlID(
- ASN1Sequence seq)
- {
- Enumeration e = seq.getObjects();
- while (e.hasMoreElements())
- {
- ASN1TaggedObject o = (ASN1TaggedObject)e.nextElement();
- switch (o.getTagNo())
- {
- case 0:
- crlUrl = DERIA5String.getInstance(o, true);
- break;
- case 1:
- crlNum = DERInteger.getInstance(o, true);
- break;
- case 2:
- crlTime = DERGeneralizedTime.getInstance(o, true);
- break;
- default:
- throw new IllegalArgumentException(
- "unknown tag number: " + o.getTagNo());
- }
- }
- }
- public DERIA5String getCrlUrl()
- {
- return crlUrl;
- }
- public DERInteger getCrlNum()
- {
- return crlNum;
- }
- public DERGeneralizedTime getCrlTime()
- {
- return crlTime;
- }
- /**
- * <pre>
- * CrlID ::= SEQUENCE {
- * crlUrl [0] EXPLICIT IA5String OPTIONAL,
- * crlNum [1] EXPLICIT INTEGER OPTIONAL,
- * crlTime [2] EXPLICIT GeneralizedTime OPTIONAL }
- * </pre>
- */
- public DERObject getDERObject()
- {
- ASN1EncodableVector v = new ASN1EncodableVector();
- if (crlUrl != null)
- {
- v.add(new DERTaggedObject(true, 0, crlUrl));
- }
- if (crlNum != null)
- {
- v.add(new DERTaggedObject(true, 1, crlNum));
- }
- if (crlTime != null)
- {
- v.add(new DERTaggedObject(true, 2, crlTime));
- }
- return new DERSequence(v);
- }
- }