⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 privatekeyusageperiod.java

📁 kmlnjlkj nlkjlkjkljl okopokipoipo oipipipo i
💻 JAVA
字号:
package org.bouncycastle.asn1.x509;import org.bouncycastle.asn1.ASN1Encodable;import org.bouncycastle.asn1.ASN1EncodableVector;import org.bouncycastle.asn1.ASN1Sequence;import org.bouncycastle.asn1.ASN1TaggedObject;import org.bouncycastle.asn1.DERGeneralizedTime;import org.bouncycastle.asn1.DERObject;import org.bouncycastle.asn1.DERSequence;import org.bouncycastle.asn1.DERTaggedObject;import java.util.Enumeration;/** * <pre> *    PrivateKeyUsagePeriod ::= SEQUENCE { *      notBefore       [0]     GeneralizedTime OPTIONAL, *      notAfter        [1]     GeneralizedTime OPTIONAL } * </pre> */public class PrivateKeyUsagePeriod    extends ASN1Encodable{    public static PrivateKeyUsagePeriod getInstance(Object obj)    {        if (obj instanceof PrivateKeyUsagePeriod)        {            return (PrivateKeyUsagePeriod)obj;        }        if (obj instanceof ASN1Sequence)        {            return new PrivateKeyUsagePeriod((ASN1Sequence)obj);        }        if (obj instanceof X509Extension)        {            return getInstance(X509Extension.convertValueToObject((X509Extension)obj));        }        throw new IllegalArgumentException("unknown object in getInstance: " + obj.getClass().getName());    }    private DERGeneralizedTime _notBefore, _notAfter;    private PrivateKeyUsagePeriod(ASN1Sequence seq)    {        Enumeration en = seq.getObjects();        while (en.hasMoreElements())        {            ASN1TaggedObject tObj = (ASN1TaggedObject)en.nextElement();            if (tObj.getTagNo() == 0)            {                _notBefore = DERGeneralizedTime.getInstance(tObj, false);            }            else if (tObj.getTagNo() == 1)            {                _notAfter = DERGeneralizedTime.getInstance(tObj, false);            }        }    }    public DERGeneralizedTime getNotBefore()    {        return _notBefore;    }    public DERGeneralizedTime getNotAfter()    {        return _notAfter;    }    public DERObject toASN1Object()    {        ASN1EncodableVector v = new ASN1EncodableVector();        if (_notBefore != null)        {            v.add(new DERTaggedObject(false, 0, _notBefore));        }        if (_notAfter != null)        {            v.add(new DERTaggedObject(false, 1, _notAfter));        }        return new DERSequence(v);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -