當前位置: 首頁>>代碼示例>>Java>>正文


Java X509Certificate.getTBSCertificate方法代碼示例

本文整理匯總了Java中java.security.cert.X509Certificate.getTBSCertificate方法的典型用法代碼示例。如果您正苦於以下問題:Java X509Certificate.getTBSCertificate方法的具體用法?Java X509Certificate.getTBSCertificate怎麽用?Java X509Certificate.getTBSCertificate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.security.cert.X509Certificate的用法示例。


在下文中一共展示了X509Certificate.getTBSCertificate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getIssuerX509Principal

import java.security.cert.X509Certificate; //導入方法依賴的package包/類
/**
 * return the issuer of the given cert as an X509PrincipalObject.
 */
public static X509Principal getIssuerX509Principal(
    X509Certificate cert)
    throws CertificateEncodingException
{
    try
    {
        ByteArrayInputStream    bIn = new ByteArrayInputStream(
            cert.getTBSCertificate());
        ASN1InputStream         aIn = new ASN1InputStream(bIn);
        TBSCertificateStructure tbsCert = new TBSCertificateStructure(
                                        (ASN1Sequence)aIn.readObject());

        return new X509Principal(tbsCert.getIssuer());
    }
    catch (IOException e)
    {
        throw new CertificateEncodingException(e.toString());
    }
}
 
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:23,代碼來源:PrincipalUtil.java

示例2: getSubjectX509Principal

import java.security.cert.X509Certificate; //導入方法依賴的package包/類
/**
 * return the subject of the given cert as an X509PrincipalObject.
 */
public static X509Principal getSubjectX509Principal(
    X509Certificate cert)
    throws CertificateEncodingException
{
    try
    {
        ByteArrayInputStream    bIn = new ByteArrayInputStream(
            cert.getTBSCertificate());
        ASN1InputStream         aIn = new ASN1InputStream(bIn);
        TBSCertificateStructure tbsCert = new TBSCertificateStructure(
                                        (ASN1Sequence)aIn.readObject());

        return new X509Principal(tbsCert.getSubject());
    }
    catch (IOException e)
    {
        throw new CertificateEncodingException(e.toString());
    }
}
 
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:23,代碼來源:PrincipalUtil.java

示例3: populateCertIssuerNames

import java.security.cert.X509Certificate; //導入方法依賴的package包/類
/**
 * Populate array of Issuer DNs from certificates and convert
 * each Principal to type X500Name if necessary.
 */
private void populateCertIssuerNames() {
    if (certificates == null)
        return;

    certIssuerNames = new Principal[certificates.length];
    for (int i = 0; i < certificates.length; i++) {
        X509Certificate cert = certificates[i];
        Principal certIssuerName = cert.getIssuerDN();
        if (!(certIssuerName instanceof X500Name)) {
            // must extract the original encoded form of DN for
            // subsequent name comparison checks (converting to a
            // String and back to an encoded DN could cause the
            // types of String attribute values to be changed)
            try {
                X509CertInfo tbsCert =
                    new X509CertInfo(cert.getTBSCertificate());
                certIssuerName = (Principal)
                    tbsCert.get(X509CertInfo.ISSUER + "." +
                                X509CertInfo.DN_NAME);
            } catch (Exception e) {
                // error generating X500Name object from the cert's
                // issuer DN, leave name as is.
            }
        }
        certIssuerNames[i] = certIssuerName;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:32,代碼來源:PKCS7.java


注:本文中的java.security.cert.X509Certificate.getTBSCertificate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。