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

📄 x509crl.java

📁 进行与数字证书相关开发必须的java源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   X509CRL.java

package jit.asn1parser.x509;

import java.io.*;
import java.util.Date;
import jit.asn1.*;
import jit.asn1.pkcs.PKCSObjectIdentifiers;
import jit.asn1.x509.*;
import jit.asn1parser.Parser;
import jit.cryptolib.toolkit.Crypto;
import jit.jcrypto.JKey;
import jit.jcrypto.Session;
import jit.jcrypto.soft.JMechanism;
import jit.math.BigInteger;

// Referenced classes of package jit.asn1parser.x509:
//            X509Cert

public class X509CRL
{

    private TBSCertList tbsCertList;
    private AlgorithmIdentifier signatureAlg;
    private DERBitString signatureValue;
    private CertificateList crl;
    private V2TBSCertListGenerator tbsCertListGenerator;

    public X509CRL()
    {
        tbsCertList = null;
        signatureAlg = null;
        signatureValue = null;
        crl = null;
        tbsCertListGenerator = null;
        tbsCertListGenerator = new V2TBSCertListGenerator();
    }

    public X509CRL(ASN1Sequence seq)
    {
        tbsCertList = null;
        signatureAlg = null;
        signatureValue = null;
        crl = null;
        tbsCertListGenerator = null;
        crl = new CertificateList(seq);
    }

    public X509CRL(String CRLFileName)
        throws Exception
    {
        tbsCertList = null;
        signatureAlg = null;
        signatureValue = null;
        crl = null;
        tbsCertListGenerator = null;
        try
        {
            InputStream crlFis = new FileInputStream(CRLFileName);
            ASN1InputStream crlAsnIn = new ASN1InputStream(crlFis);
            ASN1Sequence crlAsnSeq = (ASN1Sequence)crlAsnIn.readObject();
            crl = new CertificateList(crlAsnSeq);
        }
        catch(Exception e)
        {
            throw new Exception("construct crl error :".concat(String.valueOf(String.valueOf(e.toString()))));
        }
    }

    public X509CRL(byte bCrl[])
        throws Exception
    {
        tbsCertList = null;
        signatureAlg = null;
        signatureValue = null;
        crl = null;
        tbsCertListGenerator = null;
        try
        {
            ByteArrayInputStream bis = new ByteArrayInputStream(bCrl);
            ASN1InputStream ais = new ASN1InputStream(bis);
            ASN1Sequence seq = (ASN1Sequence)ais.readObject();
            crl = new CertificateList(seq);
        }
        catch(Exception e)
        {
            throw new Exception("construct crl error :".concat(String.valueOf(String.valueOf(e.toString()))));
        }
    }

    public X509CRL(CertificateList certificateList)
    {
        tbsCertList = null;
        signatureAlg = null;
        signatureValue = null;
        crl = null;
        tbsCertListGenerator = null;
        crl = certificateList;
    }

    public CertificateList getCertificateList()
    {
        return crl;
    }

    public byte[] getTBSCertList()
        throws Exception
    {
        if(crl == null)
            throw new Exception("please call X509CRL(ASN1Sequence seq) or X509CRL(byte[] crl)or X509CRL(String CRLFileName)");
        byte tbsCertList[] = null;
        try
        {
            tbsCertList = Parser.writeDERObj2Bytes(crl.getTBSCertList().getDERObject());
        }
        catch(Exception e)
        {
            throw new Exception("error from get TBSCertList");
        }
        return tbsCertList;
    }

    public AlgorithmIdentifier getSignatureAlgorithm()
        throws Exception
    {
        if(crl == null)
            throw new Exception("please call X509CRL(ASN1Sequence seq) or X509CRL(byte[] crl)or X509CRL(String CRLFileName)");
        else
            return crl.getSignatureAlgorithm();
    }

    public byte[] getSignature()
        throws Exception
    {
        if(crl == null)
            throw new Exception("please call X509CRL(ASN1Sequence seq) or X509CRL(byte[] crl)or X509CRL(String CRLFileName)");
        else
            return crl.getSignature().getBytes();
    }

    public int getVersion()
        throws Exception
    {
        if(crl == null)
            throw new Exception("please call X509CRL(ASN1Sequence seq) or X509CRL(byte[] crl)or X509CRL(String CRLFileName)");
        else
            return crl.getVersion();
    }

    public X509Name getIssuer()
        throws Exception
    {
        if(crl == null)
            throw new Exception("please call X509CRL(ASN1Sequence seq) or X509CRL(byte[] crl)or X509CRL(String CRLFileName)");
        else
            return crl.getIssuer();
    }

    public Time getThisUpdate()
        throws Exception
    {
        if(crl == null)
            throw new Exception("please call X509CRL(ASN1Sequence seq) or X509CRL(byte[] crl)or X509CRL(String CRLFileName)");
        else
            return crl.getThisUpdate();
    }

    public Time getNextUpdate()
        throws Exception
    {
        if(crl == null)
            throw new Exception("please call X509CRL(ASN1Sequence seq) or X509CRL(byte[] crl)or X509CRL(String CRLFileName)");
        else
            return crl.getNextUpdate();
    }

    public CRLEntry[] getRevokedCertificates()
        throws Exception
    {
        if(crl == null)
            throw new Exception("please call X509CRL(ASN1Sequence seq) or X509CRL(byte[] crl)or X509CRL(String CRLFileName)");
        else
            return crl.getRevokedCertificates();
    }

    public X509Extensions getExtensions()
        throws Exception
    {
        if(crl == null)
            throw new Exception("please call X509CRL(ASN1Sequence seq) or X509CRL(byte[] crl)or X509CRL(String CRLFileName)");
        else
            return crl.getExtensions();
    }

    public void setSignatureAlg(AlgorithmIdentifier alg)
        throws Exception
    {
        DERObjectIdentifier algOID = alg.getObjectId();
        if(!algOID.equals(PKCSObjectIdentifiers.md2WithRSAEncryption) && !algOID.equals(PKCSObjectIdentifiers.md5WithRSAEncryption) && !algOID.equals(PKCSObjectIdentifiers.sha1WithRSAEncryption) && !algOID.equals(PKCSObjectIdentifiers.sha1WithECEncryption))
        {
            throw new Exception("unsupported type of signature algorithm");
        } else
        {
            signatureAlg = alg;
            tbsCertListGenerator.setSignature(alg);
            return;
        }
    }

    public void setIssuer(X509Name issuer)
    {
        tbsCertListGenerator.setIssuer(issuer);
    }

    public void setThisUpdate(Date thisUpate)
    {
        tbsCertListGenerator.setThisUpdate(new Time(thisUpate));
    }

    public void setNextUpdate(Date nextUpdate)
    {
        tbsCertListGenerator.setNextUpdate(new Time(nextUpdate));
    }

    public void setExtensions(X509Extensions extensions)

⌨️ 快捷键说明

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