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


Java ASN1Primitive.fromByteArray方法代码示例

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


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

示例1: getAlgorithmIdentifier

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
AlgorithmIdentifier getAlgorithmIdentifier(ASN1ObjectIdentifier encryptionOID, AlgorithmParameters params)
    throws CRMFException
{
    ASN1Encodable asn1Params;
    if (params != null)
    {
        try
        {
            asn1Params = ASN1Primitive.fromByteArray(params.getEncoded("ASN.1"));
        }
        catch (IOException e)
        {
            throw new CRMFException("cannot encode parameters: " + e.getMessage(), e);
        }
    }
    else
    {
        asn1Params = DERNull.INSTANCE;
    }

    return new AlgorithmIdentifier(
        encryptionOID,
        asn1Params);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:CRMFHelper.java

示例2: getResponseObject

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
public Object getResponseObject()
    throws OCSPException
{
    ResponseBytes   rb = this.resp.getResponseBytes();

    if (rb == null)
    {
        return null;
    }

    if (rb.getResponseType().equals(OCSPObjectIdentifiers.id_pkix_ocsp_basic))
    {
        try
        {
            ASN1Primitive obj = ASN1Primitive.fromByteArray(rb.getResponse().getOctets());
            return new BasicOCSPResp(BasicOCSPResponse.getInstance(obj));
        }
        catch (Exception e)
        {
            throw new OCSPException("problem decoding object: " + e, e);
        }
    }

    return rb.getResponse();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:26,代码来源:OCSPResp.java

示例3: getAlgorithmIdentifier

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
AlgorithmIdentifier getAlgorithmIdentifier(ASN1ObjectIdentifier encryptionOID, AlgorithmParameters params)
    throws CMSException
{
    ASN1Encodable asn1Params;
    if (params != null)
    {
        try
        {
            asn1Params = ASN1Primitive.fromByteArray(params.getEncoded("ASN.1"));
        }
        catch (IOException e)
        {
            throw new CMSException("cannot encode parameters: " + e.getMessage(), e);
        }
    }
    else
    {
        asn1Params = DERNull.INSTANCE;
    }

    return new AlgorithmIdentifier(
        encryptionOID,
        asn1Params);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:EnvelopedDataHelper.java

示例4: OtherRevVals

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
private OtherRevVals(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    this.otherRevValType = (ASN1ObjectIdentifier)seq.getObjectAt(0);
    try
    {
        this.otherRevVals = ASN1Primitive.fromByteArray(seq.getObjectAt(1)
            .toASN1Primitive().getEncoded(ASN1Encoding.DER));
    }
    catch (IOException e)
    {
        throw new IllegalStateException();
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:OtherRevVals.java

示例5: OtherRevRefs

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
private OtherRevRefs(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    this.otherRevRefType = new ASN1ObjectIdentifier(((ASN1ObjectIdentifier)seq.getObjectAt(0)).getId());
    try
    {
        this.otherRevRefs = ASN1Primitive.fromByteArray(seq.getObjectAt(1)
            .toASN1Primitive().getEncoded(ASN1Encoding.DER));
    }
    catch (IOException e)
    {
        throw new IllegalStateException();
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:OtherRevRefs.java

示例6: valueFromHexString

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
public static ASN1Encodable valueFromHexString(
    String  str,
    int     off)
    throws IOException
{
    byte[] data = new byte[(str.length() - off) / 2];
    for (int index = 0; index != data.length; index++)
    {
        char left = str.charAt((index * 2) + off);
        char right = str.charAt((index * 2) + off + 1);

        data[index] = (byte)((convertHex(left) << 4) | convertHex(right));
    }

    return ASN1Primitive.fromByteArray(data);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:IETFUtils.java

示例7: engineInit

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
protected void engineInit(
    byte[] params)
    throws IOException
{
    //
    // check that we don't have a DER encoded octet string
    //
    if ((params.length % 8) != 0
        && params[0] == 0x04 && params[1] == params.length - 2)
    {
        ASN1OctetString oct = (ASN1OctetString)ASN1Primitive.fromByteArray(params);

        params = oct.getOctets();
    }

    this.iv = Arrays.clone(params);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:IvAlgorithmParameters.java

示例8: getAlgorithmIdentifier

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
protected AlgorithmIdentifier getAlgorithmIdentifier(String encryptionOID, AlgorithmParameters params) throws IOException
{
    ASN1Encodable asn1Params;
    if (params != null)
    {
        asn1Params = ASN1Primitive.fromByteArray(params.getEncoded("ASN.1"));
    }
    else
    {
        asn1Params = DERNull.INSTANCE;
    }

    return new AlgorithmIdentifier(
        new ASN1ObjectIdentifier(encryptionOID),
        asn1Params);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:CMSEnvelopedGenerator.java

示例9: fromExtensionValue

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
public static ASN1Primitive fromExtensionValue(
    byte[]  encodedValue) 
    throws IOException
{
    ASN1OctetString octs = (ASN1OctetString)ASN1Primitive.fromByteArray(encodedValue);
    
    return ASN1Primitive.fromByteArray(octs.getOctets());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:9,代码来源:X509ExtensionUtil.java

示例10: derDecode

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
private BigInteger[] derDecode(
    byte[] encoding)
    throws IOException
{
    ASN1Sequence s = (ASN1Sequence)ASN1Primitive.fromByteArray(encoding);

    return new BigInteger[]
    {
        ((DERInteger)s.getObjectAt(0)).getValue(),
        ((DERInteger)s.getObjectAt(1)).getValue()
    };
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:DSADigestSigner.java

示例11: convertValueToObject

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
/**
 * Convert the value of the passed in extension to an object
 * @param ext the extension to parse
 * @return the object the value string contains
 * @exception IllegalArgumentException if conversion is not possible
 */
public static ASN1Primitive convertValueToObject(
    X509Extension ext)
    throws IllegalArgumentException
{
    try
    {
        return ASN1Primitive.fromByteArray(ext.getValue().getOctets());
    }
    catch (IOException e)
    {
        throw new IllegalArgumentException("can't convert extension: " +  e);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:X509Extension.java

示例12: decodeObject

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
private static ASN1Primitive decodeObject(String oValue)
{
    try
    {
        return ASN1Primitive.fromByteArray(Hex.decode(oValue.substring(1)));
    }
    catch (IOException e)
    {
        throw new IllegalStateException("unknown encoding in name: " + e);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:IETFUtils.java

示例13: derDecode

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
private BigInteger[] derDecode(
    byte[]  encoding)
    throws IOException
{
    ASN1Sequence s = (ASN1Sequence)ASN1Primitive.fromByteArray(encoding);
    return new BigInteger[]{
        ((ASN1Integer)s.getObjectAt(0)).getValue(),
        ((ASN1Integer)s.getObjectAt(1)).getValue()
    };
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:11,代码来源:DSASigner.java

示例14: decode

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
public BigInteger[] decode(
    byte[] encoding)
    throws IOException
{
    ASN1Sequence s = (ASN1Sequence)ASN1Primitive.fromByteArray(encoding);
    BigInteger[] sig = new BigInteger[2];

    sig[0] = ASN1Integer.getInstance(s.getObjectAt(0)).getValue();
    sig[1] = ASN1Integer.getInstance(s.getObjectAt(1)).getValue();

    return sig;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:SignatureSpi.java

示例15: createSubjectKeyId

import org.bouncycastle.asn1.ASN1Primitive; //导入方法依赖的package包/类
private SubjectKeyIdentifier createSubjectKeyId(
    PublicKey pubKey)
{
    try
    {
        SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(
            (ASN1Sequence)ASN1Primitive.fromByteArray(pubKey.getEncoded()));

        return new SubjectKeyIdentifier(info);
    }
    catch (Exception e)
    {
        throw new RuntimeException("error creating key");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:16,代码来源:PKCS12KeyStoreSpi.java


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