当前位置: 首页>>代码示例>>Java>>正文


Java ASN1Set.getObjectAt方法代码示例

本文整理汇总了Java中org.bouncycastle.asn1.ASN1Set.getObjectAt方法的典型用法代码示例。如果您正苦于以下问题:Java ASN1Set.getObjectAt方法的具体用法?Java ASN1Set.getObjectAt怎么用?Java ASN1Set.getObjectAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bouncycastle.asn1.ASN1Set的用法示例。


在下文中一共展示了ASN1Set.getObjectAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExtensionsFromCSR

import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
/**
 * Extract extensions from CSR object
 */
public static Extensions getExtensionsFromCSR(JcaPKCS10CertificationRequest csr) {
    Attribute[] attributess = csr.getAttributes(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest);
    for (Attribute attribute : attributess) {
        ASN1Set attValue = attribute.getAttrValues();
        if (attValue != null) {
            ASN1Encodable extension = attValue.getObjectAt(0);
            if (extension instanceof Extensions) {
                return (Extensions) extension;
            } else if (extension instanceof DERSequence) {
                return Extensions.getInstance(extension);
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:19,代码来源:CertificateUtils.java

示例2: getValues

import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
public ASN1Encodable[] getValues()
{
    ASN1Set         s = attr.getAttrValues();
    ASN1Encodable[] values = new ASN1Encodable[s.size()];
    
    for (int i = 0; i != s.size(); i++)
    {
        values[i] = (ASN1Encodable)s.getObjectAt(i);
    }
    
    return values;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:X509Attribute.java

示例3: execute0

import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
@Override
protected Object execute0() throws Exception {
    X509CRL crl = X509Util.parseCrl(crlFile);
    String oidExtnCerts = ObjectIdentifiers.id_xipki_ext_crlCertset.getId();
    byte[] extnValue = crl.getExtensionValue(oidExtnCerts);
    if (extnValue == null) {
        throw new IllegalCmdParamException("no certificate is contained in " + crlFile);
    }

    extnValue = removingTagAndLenFromExtensionValue(extnValue);
    ASN1Set asn1Set = DERSet.getInstance(extnValue);
    final int n = asn1Set.size();
    if (n == 0) {
        throw new CmdFailure("no certificate is contained in " + crlFile);
    }

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ZipOutputStream zip = new ZipOutputStream(out);

    for (int i = 0; i < n; i++) {
        ASN1Encodable asn1 = asn1Set.getObjectAt(i);
        Certificate cert;
        try {
            ASN1Sequence seq = ASN1Sequence.getInstance(asn1);
            cert = Certificate.getInstance(seq.getObjectAt(0));
        } catch (IllegalArgumentException ex) {
            // backwards compatibility
            cert = Certificate.getInstance(asn1);
        }

        byte[] certBytes = cert.getEncoded();
        String sha1FpCert = HashAlgoType.SHA1.hexHash(certBytes);
        ZipEntry certZipEntry = new ZipEntry(sha1FpCert + ".der");
        zip.putNextEntry(certZipEntry);
        try {
            zip.write(certBytes);
        } finally {
            zip.closeEntry();
        }
    }

    zip.flush();
    zip.close();

    saveVerbose("extracted " + n + " certificates to", new File(outFile), out.toByteArray());
    return null;
}
 
开发者ID:xipki,项目名称:xitk,代码行数:48,代码来源:ExtractCertFromCrlCmd.java


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