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


Java ASN1Sequence类代码示例

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


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

示例1: McElieceCCA2PublicKey

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
private McElieceCCA2PublicKey(ASN1Sequence seq)
{
    oid = ((ASN1ObjectIdentifier)seq.getObjectAt(0));
    BigInteger bigN = ((ASN1Integer)seq.getObjectAt(1)).getValue();
    n = bigN.intValue();

    BigInteger bigT = ((ASN1Integer)seq.getObjectAt(2)).getValue();
    t = bigT.intValue();

    matrixG = ((ASN1OctetString)seq.getObjectAt(3)).getOctets();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:McElieceCCA2PublicKey.java

示例2: PKIStatusInfo

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
private PKIStatusInfo(
    ASN1Sequence seq)
{
    this.status = ASN1Integer.getInstance(seq.getObjectAt(0));

    this.statusString = null;
    this.failInfo = null;

    if (seq.size() > 2)
    {
        this.statusString = PKIFreeText.getInstance(seq.getObjectAt(1));
        this.failInfo = DERBitString.getInstance(seq.getObjectAt(2));
    }
    else if (seq.size() > 1)
    {
        Object obj = seq.getObjectAt(1); 
        if (obj instanceof DERBitString)
        {
            this.failInfo = DERBitString.getInstance(obj);
        }
        else
        {
            this.statusString = PKIFreeText.getInstance(obj);
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:PKIStatusInfo.java

示例3: getUPNStringFromSequence

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
/**
 * Get UPN String.
 *
 * @param seq ASN1Sequence abstraction representing subject alternative name.
 * First element is the object identifier, second is the object itself.
 *
 * @return UPN string or null
 */
private String getUPNStringFromSequence(final ASN1Sequence seq) {
    if (seq != null) {
        // First in sequence is the object identifier, that we must check
        final ASN1ObjectIdentifier id = ASN1ObjectIdentifier.getInstance(seq.getObjectAt(0));
        if (id != null && UPN_OBJECTID.equals(id.getId())) {
            final ASN1TaggedObject obj = (ASN1TaggedObject) seq.getObjectAt(1);
            ASN1Primitive prim = obj.getObject();
            
            // Due to bug in java cert.getSubjectAltName, it can be tagged an extra time
            if (prim instanceof ASN1TaggedObject) {
                prim = ASN1TaggedObject.getInstance(((ASN1TaggedObject) prim)).getObject();
            }

            if (prim instanceof ASN1OctetString) {
                return new String(((ASN1OctetString) prim).getOctets());
            } else if (prim instanceof ASN1String) {
                return ((ASN1String) prim).getString();
            } else{
                return null;
            }
        }
    }
    return null;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:33,代码来源:X509SubjectAlternativeNameUPNPrincipalResolver.java

示例4: resolvePrincipalInternal

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
/**
 * Retrieves Subject Alternative Name UPN extension as a principal id String.
 *
 * @param certificate X.509 certificate credential.
 *
 * @return Resolved principal ID or null if no SAN UPN extension is available in provided certificate.
 *
 * @see AbstractX509PrincipalResolver#resolvePrincipalInternal(java.security.cert.X509Certificate)
 * @see java.security.cert.X509Certificate#getSubjectAlternativeNames()
 */
@Override
protected String resolvePrincipalInternal(final X509Certificate certificate) {
    logger.debug("Resolving principal from Subject Alternative Name UPN for {}", certificate);
    try {
        final Collection<List<?>> subjectAltNames = certificate.getSubjectAlternativeNames();
        if (subjectAltNames != null) {
            for (final List<?> sanItem : subjectAltNames) {
                final ASN1Sequence seq = getAltnameSequence(sanItem);
                final String upnString = getUPNStringFromSequence(seq);
                if (upnString != null) {
                    return upnString;
                }
            }
        }
    } catch (final CertificateParsingException e) {
        logger.error("Error is encountered while trying to retrieve subject alternative names collection from certificate", e);
        logger.debug("Returning null principal id...");
        return null;
    }
    logger.debug("Returning null principal id...");
    return null;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:33,代码来源:X509SubjectAlternativeNameUPNPrincipalResolver.java

示例5: DHParameter

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
private DHParameter(
    ASN1Sequence  seq)
{
    Enumeration     e = seq.getObjects();

    p = ASN1Integer.getInstance(e.nextElement());
    g = ASN1Integer.getInstance(e.nextElement());

    if (e.hasMoreElements())
    {
        l = (ASN1Integer)e.nextElement();
    }
    else
    {
        l = null;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:DHParameter.java

示例6: getInstance

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
public static NameOrPseudonym getInstance(Object obj)
{
    if (obj == null || obj instanceof NameOrPseudonym)
    {
        return (NameOrPseudonym)obj;
    }

    if (obj instanceof ASN1String)
    {
        return new NameOrPseudonym(DirectoryString.getInstance(obj));
    }

    if (obj instanceof ASN1Sequence)
    {
        return new NameOrPseudonym((ASN1Sequence)obj);
    }

    throw new IllegalArgumentException("illegal object in getInstance: "
        + obj.getClass().getName());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:NameOrPseudonym.java

示例7: getInstance

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
public static ProtectedPart getInstance(Object o)
{
    if (o instanceof ProtectedPart)
    {
        return (ProtectedPart)o;
    }

    if (o != null)
    {
        return new ProtectedPart(ASN1Sequence.getInstance(o));
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:15,代码来源:ProtectedPart.java

示例8: CscaMasterList

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
private CscaMasterList(
    ASN1Sequence seq)
{
    if (seq == null || seq.size() == 0)
    {
        throw new IllegalArgumentException(
            "null or empty sequence passed.");
    }
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException(
            "Incorrect sequence size: " + seq.size());
    }

    version = ASN1Integer.getInstance(seq.getObjectAt(0));
    ASN1Set certSet = ASN1Set.getInstance(seq.getObjectAt(1));
    certList = new Certificate[certSet.size()];
    for (int i = 0; i < certList.length; i++)
    {
        certList[i]
            = Certificate.getInstance(certSet.getObjectAt(i));
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:CscaMasterList.java

示例9: POPOSigningKey

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
private POPOSigningKey(ASN1Sequence seq)
{
    int index = 0;

    if (seq.getObjectAt(index) instanceof ASN1TaggedObject)
    {
        ASN1TaggedObject tagObj
            = (ASN1TaggedObject)seq.getObjectAt(index++);
        if (tagObj.getTagNo() != 0)
        {
            throw new IllegalArgumentException(
                "Unknown POPOSigningKeyInput tag: " + tagObj.getTagNo());
        }
        poposkInput = POPOSigningKeyInput.getInstance(tagObj.getObject());
    }
    algorithmIdentifier = AlgorithmIdentifier.getInstance(seq.getObjectAt(index++));
    signature = DERBitString.getInstance(seq.getObjectAt(index));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:POPOSigningKey.java

示例10: addCRL

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
/**
 * Add the CRLEntry objects contained in a previous CRL.
 * 
 * @param other the X509CRL to source the other entries from. 
 */
public void addCRL(X509CRL other)
    throws CRLException
{
    Set revocations = other.getRevokedCertificates();

    if (revocations != null)
    {
        Iterator it = revocations.iterator();
        while (it.hasNext())
        {
            X509CRLEntry entry = (X509CRLEntry)it.next();

            ASN1InputStream aIn = new ASN1InputStream(entry.getEncoded());

            try
            {
                tbsGen.addCRLEntry(ASN1Sequence.getInstance(aIn.readObject()));
            }
            catch (IOException e)
            {
                throw new CRLException("exception processing encoding of CRL: " + e.toString());
            }
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:31,代码来源:X509V2CRLGenerator.java

示例11: getInstance

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
public static Asn1SignTemplate getInstance(Object obj) throws BadAsn1ObjectException {
    if (obj == null || obj instanceof Asn1SignTemplate) {
        return (Asn1SignTemplate) obj;
    }

    try {
        if (obj instanceof ASN1Sequence) {
            return new Asn1SignTemplate((ASN1Sequence) obj);
        } else if (obj instanceof byte[]) {
            return getInstance(ASN1Primitive.fromByteArray((byte[]) obj));
        } else {
            throw new BadAsn1ObjectException("unknown object: " + obj.getClass().getName());
        }
    } catch (IOException | IllegalArgumentException ex) {
        throw new BadAsn1ObjectException("unable to parse encoded object: " + ex.getMessage(),
                ex);
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:19,代码来源:Asn1SignTemplate.java

示例12: Asn1NewKeyControl

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
private Asn1NewKeyControl(ASN1Sequence seq) throws BadAsn1ObjectException {
    control = new P11NewKeyControl();
    final int size = seq.size();
    for (int i = 0; i < size; i++) {
        ASN1Encodable obj = seq.getObjectAt(i);
        if (obj instanceof ASN1TaggedObject) {
            continue;
        }

        ASN1TaggedObject tagObj = (ASN1TaggedObject) obj;
        int tagNo = tagObj.getTagNo();
        if (tagNo == 0) {
            boolean bv = ((ASN1Boolean) tagObj.getObject()).isTrue();
            control.setExtractable(bv);
        }
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:18,代码来源:Asn1NewKeyControl.java

示例13: getInstance

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
public static Asn1P11ObjectIdentifier getInstance(Object obj) throws BadAsn1ObjectException {
    if (obj == null || obj instanceof Asn1P11ObjectIdentifier) {
        return (Asn1P11ObjectIdentifier) obj;
    }

    try {
        if (obj instanceof ASN1Sequence) {
            return new Asn1P11ObjectIdentifier((ASN1Sequence) obj);
        } else if (obj instanceof byte[]) {
            return getInstance(ASN1Primitive.fromByteArray((byte[]) obj));
        } else {
            throw new BadAsn1ObjectException("unknown object: " + obj.getClass().getName());
        }
    } catch (IOException | IllegalArgumentException ex) {
        throw new BadAsn1ObjectException("unable to parse encoded object: " + ex.getMessage(),
                ex);
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:19,代码来源:Asn1P11ObjectIdentifier.java

示例14: PKCS12SafeBagFactory

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
public PKCS12SafeBagFactory(ContentInfo info, InputDecryptorProvider inputDecryptorProvider)
    throws PKCSException
{
    if (info.getContentType().equals(PKCSObjectIdentifiers.encryptedData))
    {
        CMSEncryptedData encData = new CMSEncryptedData(org.bouncycastle.asn1.cms.ContentInfo.getInstance(info));

        try
        {
            this.safeBagSeq = ASN1Sequence.getInstance(encData.getContent(inputDecryptorProvider));
        }
        catch (CMSException e)
        {
            throw new PKCSException("unable to extract data: " + e.getMessage(), e);
        }
        return;
    }

    throw new IllegalArgumentException("encryptedData requires constructor with decryptor.");
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:PKCS12SafeBagFactory.java

示例15: IssuerSerial

import org.bouncycastle.asn1.ASN1Sequence; //导入依赖的package包/类
private IssuerSerial(
    ASN1Sequence    seq)
{
    if (seq.size() != 2 && seq.size() != 3)
    {
        throw new IllegalArgumentException("Bad sequence size: " + seq.size());
    }
    
    issuer = GeneralNames.getInstance(seq.getObjectAt(0));
    serial = ASN1Integer.getInstance(seq.getObjectAt(1));

    if (seq.size() == 3)
    {
        issuerUID = DERBitString.getInstance(seq.getObjectAt(2));
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:IssuerSerial.java


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