本文整理了Java中org.spongycastle.asn1.ASN1InputStream.<init>()
方法的一些代码示例,展示了ASN1InputStream.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ASN1InputStream.<init>()
方法的具体详情如下:
包路径:org.spongycastle.asn1.ASN1InputStream
类名称:ASN1InputStream
方法名:<init>
[英]Create an ASN1InputStream where no DER object will be longer than limit.
[中]创建一个ASN1InputStream,其中DER对象的长度不会超过限制。
代码示例来源:origin: ethereum/ethereumj
public static ECDSASignature decodeFromDER(byte[] bytes) {
ASN1InputStream decoder = null;
try {
decoder = new ASN1InputStream(bytes);
DLSequence seq = (DLSequence) decoder.readObject();
if (seq == null)
throw new RuntimeException("Reached past end of ASN.1 stream.");
ASN1Integer r, s;
try {
r = (ASN1Integer) seq.getObjectAt(0);
s = (ASN1Integer) seq.getObjectAt(1);
} catch (ClassCastException e) {
throw new IllegalArgumentException(e);
}
// OpenSSL deviates from the DER spec by interpreting these values as unsigned, though they should not be
// Thus, we always use the positive versions. See: http://r6.ca/blog/20111119T211504Z.html
return new ECDSASignature(r.getPositiveValue(), s.getPositiveValue());
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
if (decoder != null)
try { decoder.close(); } catch (IOException x) {}
}
}
代码示例来源:origin: com.madgag/scprov-jdk15on
/**
* @deprecated use classes in org.spongycastle.cert.ocsp.
*/
public OCSPResp(
byte[] resp)
throws IOException
{
this(new ASN1InputStream(resp));
}
代码示例来源:origin: com.madgag/scprov-jdk15on
/**
* @deprecated use classes in org.spongycastle.cert.ocsp.
*/
public OCSPResp(
InputStream in)
throws IOException
{
this(new ASN1InputStream(in));
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
public OCSPReq(
byte[] req)
throws IOException
{
this(new ASN1InputStream(req));
}
代码示例来源:origin: com.madgag.spongycastle/pkix
public OCSPResp(
InputStream resp)
throws IOException
{
this(new ASN1InputStream(resp));
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
public OCSPResp(
InputStream resp)
throws IOException
{
this(new ASN1InputStream(resp));
}
代码示例来源:origin: com.madgag.spongycastle/core
public LazyConstructionEnumeration(byte[] encoded)
{
aIn = new ASN1InputStream(encoded, true);
nextObj = readObject();
}
代码示例来源:origin: com.madgag.spongycastle/pkix
static ContentInfo readContentInfo(
InputStream input)
throws CMSException
{
// enforce some limit checking
return readContentInfo(new ASN1InputStream(input));
}
代码示例来源:origin: com.madgag/sc-light-jdk15on
ASN1EncodableVector buildDEREncodableVector(
DefiniteLengthInputStream dIn) throws IOException
{
return new ASN1InputStream(dIn).buildEncodableVector();
}
代码示例来源:origin: com.madgag.spongycastle/core
ASN1EncodableVector buildDEREncodableVector(
DefiniteLengthInputStream dIn) throws IOException
{
return new ASN1InputStream(dIn).buildEncodableVector();
}
代码示例来源:origin: com.madgag/scprov-jdk15on
/**
* Constructor from an encoded byte array.
*/
public X509Principal(
byte[] bytes)
throws IOException
{
super(readSequence(new ASN1InputStream(bytes)));
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
static ContentInfo readContentInfo(
InputStream input)
throws CMSException
{
// enforce some limit checking
return readContentInfo(new ASN1InputStream(input));
}
代码示例来源:origin: com.madgag/scprov-jdk15on
private static ASN1Sequence getReq(
byte[] r)
throws IOException
{
ASN1InputStream aIn = new ASN1InputStream(new ByteArrayInputStream(r));
return ASN1Sequence.getInstance(aIn.readObject());
}
代码示例来源:origin: com.madgag.spongycastle/prov
private static ASN1Sequence getReq(
byte[] r)
throws IOException
{
ASN1InputStream aIn = new ASN1InputStream(new ByteArrayInputStream(r));
return ASN1Sequence.getInstance(aIn.readObject());
}
代码示例来源:origin: com.madgag.spongycastle/core
public static void main(
String args[])
throws Exception
{
FileInputStream fIn = new FileInputStream(args[0]);
ASN1InputStream bIn = new ASN1InputStream(fIn);
Object obj = null;
while ((obj = bIn.readObject()) != null)
{
System.out.println(ASN1Dump.dumpAsString(obj));
}
}
}
代码示例来源:origin: com.madgag/scprov-jdk15on
private X509CertificatePair readDERCrossCertificatePair(
InputStream in)
throws IOException, CertificateParsingException
{
ASN1InputStream dIn = new ASN1InputStream(in);
ASN1Sequence seq = (ASN1Sequence)dIn.readObject();
CertificatePair pair = CertificatePair.getInstance(seq);
return new X509CertificatePair(pair);
}
代码示例来源:origin: com.madgag/sc-light-jdk15on
/**
* Create a private key parameter from a PKCS8 PrivateKeyInfo encoding read from a
* stream.
*
* @param inStr the stream to read the PrivateKeyInfo encoding from
* @return a suitable private key parameter
* @throws IOException on an error decoding the key
*/
public static AsymmetricKeyParameter createKey(InputStream inStr) throws IOException
{
return createKey(PrivateKeyInfo.getInstance(new ASN1InputStream(inStr).readObject()));
}
代码示例来源:origin: com.madgag/sc-light-jdk15on
/**
* Create a public key from a SubjectPublicKeyInfo encoding read from a stream
*
* @param inStr the stream to read the SubjectPublicKeyInfo encoding from
* @return the appropriate key parameter
* @throws IOException on an error decoding the key
*/
public static AsymmetricKeyParameter createKey(InputStream inStr) throws IOException
{
return createKey(SubjectPublicKeyInfo.getInstance(new ASN1InputStream(inStr).readObject()));
}
代码示例来源:origin: com.madgag.spongycastle/pkix
public X509TrustedCertificateBlock(byte[] encoding)
throws IOException
{
ASN1InputStream aIn = new ASN1InputStream(encoding);
this.certificateHolder = new X509CertificateHolder(aIn.readObject().getEncoded());
this.trustBlock = new CertificateTrustBlock(aIn.readObject().getEncoded());
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
public X509TrustedCertificateBlock(byte[] encoding)
throws IOException
{
ASN1InputStream aIn = new ASN1InputStream(encoding);
this.certificateHolder = new X509CertificateHolder(aIn.readObject().getEncoded());
this.trustBlock = new CertificateTrustBlock(aIn.readObject().getEncoded());
}
内容来源于网络,如有侵权,请联系作者删除!