• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SerialNumber类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中sun.security.x509.SerialNumber的典型用法代码示例。如果您正苦于以下问题:Java SerialNumber类的具体用法?Java SerialNumber怎么用?Java SerialNumber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SerialNumber类属于sun.security.x509包,在下文中一共展示了SerialNumber类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setSkiAndSerialNumber

import sun.security.x509.SerialNumber; //导入依赖的package包/类
/**
 * Sets the subjectKeyIdentifier and serialNumber criteria from the
 * authority key identifier extension.
 *
 * The subjectKeyIdentifier criterion is set to the keyIdentifier field
 * of the extension, or null if it is empty. The serialNumber criterion
 * is set to the authorityCertSerialNumber field, or null if it is empty.
 *
 * Note that we do not set the subject criterion to the
 * authorityCertIssuer field of the extension. The caller MUST set
 * the subject criterion before calling match().
 *
 * @param ext the authorityKeyIdentifier extension
 * @throws IOException if there is an error parsing the extension
 */
void setSkiAndSerialNumber(AuthorityKeyIdentifierExtension ext)
    throws IOException {

    ski = null;
    serial = null;

    if (ext != null) {
        KeyIdentifier akid = (KeyIdentifier)ext.get(
            AuthorityKeyIdentifierExtension.KEY_ID);
        if (akid != null) {
            DerOutputStream derout = new DerOutputStream();
            derout.putOctetString(akid.getIdentifier());
            ski = derout.toByteArray();
        }
        SerialNumber asn = (SerialNumber)ext.get(
            AuthorityKeyIdentifierExtension.SERIAL_NUMBER);
        if (asn != null) {
            serial = asn.getNumber();
        }
        // the subject criterion should be set by the caller
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:AdaptableX509CertSelector.java


示例2: setSkiAndSerialNumber

import sun.security.x509.SerialNumber; //导入依赖的package包/类
/**
 * Sets the subjectKeyIdentifier and serialNumber criteria from the
 * authority key identifier extension.
 *
 * The subjectKeyIdentifier criterion is set to the keyIdentifier field
 * of the extension, or null if it is empty. The serialNumber criterion
 * is set to the authorityCertSerialNumber field, or null if it is empty.
 *
 * Note that we do not set the subject criterion to the
 * authorityCertIssuer field of the extension. The caller MUST set
 * the subject criterion before calling match().
 *
 * @param ext the authorityKeyIdentifier extension
 * @throws IOException if there is an error parsing the extension
 */
void setSkiAndSerialNumber(AuthorityKeyIdentifierExtension ext)
    throws IOException {

    ski = null;
    serial = null;

    if (ext != null) {
        ski = ext.getEncodedKeyIdentifier();
        SerialNumber asn = (SerialNumber)ext.get(
            AuthorityKeyIdentifierExtension.SERIAL_NUMBER);
        if (asn != null) {
            serial = asn.getNumber();
        }
        // the subject criterion should be set by the caller
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:32,代码来源:AdaptableX509CertSelector.java


示例3: ESSCertId

import sun.security.x509.SerialNumber; //导入依赖的package包/类
ESSCertId(DerValue certId) throws IOException {
    // Parse certHash
    certHash = certId.data.getDerValue().toByteArray();

    // Parse issuerSerial, if present
    if (certId.data.available() > 0) {
        DerValue issuerSerial = certId.data.getDerValue();
        // Parse issuer
        issuer = new GeneralNames(issuerSerial.data.getDerValue());
        // Parse serialNumber
        serialNumber = new SerialNumber(issuerSerial.data.getDerValue());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:SigningCertificateInfo.java


示例4: parseAuthorityKeyIdentifierExtension

import sun.security.x509.SerialNumber; //导入依赖的package包/类
/**
 * Parse the authority key identifier extension.
 *
 * If the keyIdentifier field of the extension is non-null, set the
 * subjectKeyIdentifier criterion. If the authorityCertSerialNumber
 * field is non-null, set the serialNumber criterion.
 *
 * Note that we will not set the subject criterion according to the
 * authorityCertIssuer field of the extension. The caller MUST set
 * the subject criterion before call match().
 *
 * @param akidext the authorityKeyIdentifier extension
 */
void parseAuthorityKeyIdentifierExtension(
        AuthorityKeyIdentifierExtension akidext) throws IOException {
    if (akidext != null) {
        KeyIdentifier akid = (KeyIdentifier)akidext.get(akidext.KEY_ID);
        if (akid != null) {
            // Do not override the previous setting for initial selection.
            if (isSKIDSensitive || getSubjectKeyIdentifier() == null) {
                DerOutputStream derout = new DerOutputStream();
                derout.putOctetString(akid.getIdentifier());
                super.setSubjectKeyIdentifier(derout.toByteArray());

                isSKIDSensitive = true;
            }
        }

        SerialNumber asn =
            (SerialNumber)akidext.get(akidext.SERIAL_NUMBER);
        if (asn != null) {
            // Do not override the previous setting for initial selection.
            if (isSNSensitive || getSerialNumber() == null) {
                super.setSerialNumber(asn.getNumber());
                isSNSensitive = true;
            }
        }

        // the subject criterion should be set by the caller.
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:42,代码来源:AdaptableX509CertSelector.java


示例5: parseAuthorityKeyIdentifierExtension

import sun.security.x509.SerialNumber; //导入依赖的package包/类
/**
 * Parse the authority key identifier extension.
 *
 * If the keyIdentifier field of the extension is non-null, set the
 * subjectKeyIdentifier criterion. If the authorityCertSerialNumber
 * field is non-null, set the serialNumber criterion.
 *
 * Note that we will not set the subject criterion according to the
 * authorityCertIssuer field of the extension. The caller MUST set
 * the subject criterion before call match().
 *
 * @param akidext the authorityKeyIdentifier extension
 */
void parseAuthorityKeyIdentifierExtension(
        AuthorityKeyIdentifierExtension akidext) throws IOException {
    if (akidext != null) {
        KeyIdentifier akid = (KeyIdentifier)akidext.get(
                AuthorityKeyIdentifierExtension.KEY_ID);
        if (akid != null) {
            // Do not override the previous setting for initial selection.
            if (isSKIDSensitive || getSubjectKeyIdentifier() == null) {
                DerOutputStream derout = new DerOutputStream();
                derout.putOctetString(akid.getIdentifier());
                super.setSubjectKeyIdentifier(derout.toByteArray());

                isSKIDSensitive = true;
            }
        }

        SerialNumber asn = (SerialNumber)akidext.get(
                AuthorityKeyIdentifierExtension.SERIAL_NUMBER);
        if (asn != null) {
            // Do not override the previous setting for initial selection.
            if (isSNSensitive || getSerialNumber() == null) {
                super.setSerialNumber(asn.getNumber());
                isSNSensitive = true;
            }
        }

        // the subject criterion should be set by the caller.
    }
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:43,代码来源:AdaptableX509CertSelector.java


示例6: encodeTbsCert

import sun.security.x509.SerialNumber; //导入依赖的package包/类
/**
 * Encode the bytes for the TBSCertificate structure:
 * <PRE>
 *  TBSCertificate  ::=  SEQUENCE  {
 *      version         [0]  EXPLICIT Version DEFAULT v1,
 *      serialNumber         CertificateSerialNumber,
 *      signature            AlgorithmIdentifier,
 *      issuer               Name,
 *      validity             Validity,
 *      subject              Name,
 *      subjectPublicKeyInfo SubjectPublicKeyInfo,
 *      issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL,
 *                        -- If present, version MUST be v2 or v3
 *      subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,
 *                        -- If present, version MUST be v2 or v3
 *      extensions      [3]  EXPLICIT Extensions OPTIONAL
 *                        -- If present, version MUST be v3
 *      }
 *
 * @param issuerCert The certificate of the issuing authority, or
 * {@code null} if the resulting certificate is self-signed.
 * @param signAlg The signature algorithm object
 *
 * @return The DER-encoded bytes for the TBSCertificate structure
 *
 * @throws IOException if an encoding error occurs.
 */
private byte[] encodeTbsCert(X509Certificate issuerCert,
        AlgorithmId signAlg) throws IOException {
    DerOutputStream tbsCertSeq = new DerOutputStream();
    DerOutputStream tbsCertItems = new DerOutputStream();

    // Hardcode to V3
    byte[] v3int = {0x02, 0x01, 0x02};
    tbsCertItems.write(DerValue.createTag(DerValue.TAG_CONTEXT, true,
            (byte)0), v3int);

    // Serial Number
    SerialNumber sn = new SerialNumber(serialNumber);
    sn.encode(tbsCertItems);

    // Algorithm ID
    signAlg.derEncode(tbsCertItems);

    // Issuer Name
    if (issuerCert != null) {
        tbsCertItems.write(
                issuerCert.getSubjectX500Principal().getEncoded());
    } else {
        // Self-signed
        tbsCertItems.write(subjectName.getEncoded());
    }

    // Validity period (set as UTCTime)
    DerOutputStream valSeq = new DerOutputStream();
    valSeq.putUTCTime(notBefore);
    valSeq.putUTCTime(notAfter);
    tbsCertItems.write(DerValue.tag_Sequence, valSeq);

    // Subject Name
    tbsCertItems.write(subjectName.getEncoded());

    // SubjectPublicKeyInfo
    tbsCertItems.write(publicKey.getEncoded());

    // TODO: Extensions!
    encodeExtensions(tbsCertItems);

    // Wrap it all up in a SEQUENCE and return the bytes
    tbsCertSeq.write(DerValue.tag_Sequence, tbsCertItems);
    return tbsCertSeq.toByteArray();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:73,代码来源:CertificateBuilder.java


示例7: StatusInfo

import sun.security.x509.SerialNumber; //导入依赖的package包/类
/**
 * Create a StatusInfo object from certificate data.
 *
 * @param subjectCert the certificate to be checked for revocation
 * @param issuerCert the issuer of the {@code subjectCert}
 *
 * @throws IOException if CertId creation from the certificates fails
 */
StatusInfo(X509Certificate subjectCert, X509Certificate issuerCert)
        throws IOException {
    this(subjectCert, new CertId(issuerCert,
            new SerialNumber(subjectCert.getSerialNumber())));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:StatusResponseManager.java



注:本文中的sun.security.x509.SerialNumber类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SmackDebugger类代码示例发布时间:2022-05-21
下一篇:
Java RecipientType类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap