當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。