本文整理了Java中org.spongycastle.asn1.ASN1Primitive.fromByteArray()
方法的一些代码示例,展示了ASN1Primitive.fromByteArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ASN1Primitive.fromByteArray()
方法的具体详情如下:
包路径:org.spongycastle.asn1.ASN1Primitive
类名称:ASN1Primitive
方法名:fromByteArray
[英]Create a base ASN.1 object from a byte stream.
[中]创建一个基本ASN。字节流中的1个对象。
代码示例来源:origin: com.madgag.spongycastle/prov
public static ASN1Primitive fromExtensionValue(
byte[] encodedValue)
throws IOException
{
ASN1OctetString octs = (ASN1OctetString)ASN1Primitive.fromByteArray(encodedValue);
return ASN1Primitive.fromByteArray(octs.getOctets());
}
代码示例来源:origin: com.madgag/scprov-jdk15on
public static ASN1Primitive fromExtensionValue(
byte[] encodedValue)
throws IOException
{
ASN1OctetString octs = (ASN1OctetString)ASN1Primitive.fromByteArray(encodedValue);
return ASN1Primitive.fromByteArray(octs.getOctets());
}
代码示例来源:origin: com.madgag.spongycastle/core
public ASN1Encodable parsePrivateKey()
throws IOException
{
return ASN1Primitive.fromByteArray(privKey.getOctets());
}
代码示例来源:origin: com.madgag.spongycastle/core
/**
* Return the enclosed object assuming explicit tagging.
*
* @return the resulting object
* @throws IOException if reconstruction fails.
*/
public ASN1Primitive getObject()
throws IOException
{
return ASN1Primitive.fromByteArray(getContents());
}
代码示例来源:origin: com.madgag.spongycastle/core
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);
}
}
代码示例来源:origin: com.madgag.spongycastle/prov
private void readObject(
ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
byte[] enc = (byte[])in.readObject();
this.configuration = BouncyCastleProvider.CONFIGURATION;
populateFromPubKeyInfo(SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc)));
}
代码示例来源:origin: com.madgag.spongycastle/prov
private void readObject(
ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
byte[] enc = (byte[])in.readObject();
populateFromPubKeyInfo(SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc)));
}
代码示例来源:origin: com.madgag.spongycastle/prov
private void readObject(
ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
byte[] enc = (byte[])in.readObject();
populateFromPubKeyInfo(SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc)));
}
代码示例来源:origin: com.madgag.spongycastle/prov
private void readObject(
ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
byte[] enc = (byte[])in.readObject();
populateFromPubKeyInfo(SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc)));
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
private static CsrAttrs parseBytes(byte[] responseEncoding)
throws ESTException
{
try
{
return CsrAttrs.getInstance(ASN1Primitive.fromByteArray(responseEncoding));
}
catch (Exception e)
{
throw new ESTException("malformed data: " + e.getMessage(), e);
}
}
代码示例来源:origin: com.madgag.spongycastle/core
/**
* If the public key is an encoded object this will return the ASN.1 primitives encoded - if the bitstring
* can't be decoded this routine throws an IOException.
*
* @exception IOException - if the bit string doesn't represent a DER encoded object.
* @return the public key as an ASN.1 primitive.
*/
public ASN1Primitive parsePublicKey()
throws IOException
{
return ASN1Primitive.fromByteArray(getSubjectPublicKey().getOctets());
}
代码示例来源:origin: com.madgag.spongycastle/core
/**
* Create a private key parameter from a PKCS8 PrivateKeyInfo encoding.
*
* @param privateKeyInfoData the PrivateKeyInfo encoding
* @return a suitable private key parameter
* @throws IOException on an error decoding the key
*/
public static AsymmetricKeyParameter createKey(byte[] privateKeyInfoData) throws IOException
{
return createKey(PrivateKeyInfo.getInstance(ASN1Primitive.fromByteArray(privateKeyInfoData)));
}
代码示例来源:origin: com.madgag.spongycastle/prov
private void readObject(
ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
byte[] enc = (byte[])in.readObject();
populateFromPrivKeyInfo(PrivateKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc)));
this.attrCarrier = new PKCS12BagAttributeCarrierImpl();
}
代码示例来源:origin: com.madgag.spongycastle/pkix
/**
* Return the ASN.1 object contained in a byte[] returned by a getExtensionValue() call.
*
* @param encExtValue DER encoded OCTET STRING containing the DER encoded extension object.
* @return an ASN.1 object
* @throws java.io.IOException on a parsing error.
*/
public static ASN1Primitive parseExtensionValue(byte[] encExtValue)
throws IOException
{
return ASN1Primitive.fromByteArray(ASN1OctetString.getInstance(encExtValue).getOctets());
}
代码示例来源:origin: com.madgag/scprov-jdk15on
private void readObject(
ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
byte[] enc = (byte[])in.readObject();
populateFromPrivKeyInfo(PrivateKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc)));
this.configuration = BouncyCastleProvider.CONFIGURATION;
this.attrCarrier = new PKCS12BagAttributeCarrierImpl();
}
代码示例来源:origin: com.madgag.spongycastle/prov
private void readObject(
ObjectInputStream in)
throws IOException, ClassNotFoundException
{
byte[] enc = (byte[])in.readObject();
populateFromPrivKeyInfo(PrivateKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc)));
this.algorithm = (String)in.readObject();
this.withCompression = in.readBoolean();
this.attrCarrier = new PKCS12BagAttributeCarrierImpl();
attrCarrier.readObject(in);
}
代码示例来源:origin: com.madgag/scprov-jdk15on
protected void engineInit(
byte[] params,
String format)
throws IOException
{
if (this.isASN1FormatString(format))
{
engineInit(params);
return;
}
throw new IOException("Unknown parameters format in PWRIKEK parameters object");
}
代码示例来源:origin: com.madgag/scprov-jdk15on
protected void engineInit(
byte[] params,
String format)
throws IOException
{
if (this.isASN1FormatString(format))
{
engineInit(params);
return;
}
throw new IOException("Unknown parameters format in PKCS12 PBE parameters object");
}
代码示例来源:origin: com.madgag/scprov-jdk15on
private DERBitString getPublicKeyDetails(BCECPublicKey pub)
{
try
{
SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(pub.getEncoded()));
return info.getPublicKeyData();
}
catch (IOException e)
{ // should never happen
return null;
}
}
代码示例来源:origin: com.madgag.spongycastle/bcpg-jdk15on
/**
* @param in the stream to read the packet from.
*/
protected ECPublicBCPGKey(
BCPGInputStream in)
throws IOException
{
this.oid = ASN1ObjectIdentifier.getInstance(ASN1Primitive.fromByteArray(readBytesOfEncodedLength(in)));
this.point = new MPInteger(in).getValue();
}
内容来源于网络,如有侵权,请联系作者删除!