本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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()
};
}
示例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);
}
}
示例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);
}
}
示例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()
};
}
示例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;
}
示例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");
}
}