本文整理匯總了Java中org.bouncycastle.asn1.ASN1InputStream.readObject方法的典型用法代碼示例。如果您正苦於以下問題:Java ASN1InputStream.readObject方法的具體用法?Java ASN1InputStream.readObject怎麽用?Java ASN1InputStream.readObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bouncycastle.asn1.ASN1InputStream
的用法示例。
在下文中一共展示了ASN1InputStream.readObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseDG1
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private void parseDG1(byte[] DG1) {
try {
ASN1InputStream bIn = new ASN1InputStream(DG1);
org.bouncycastle.asn1.DERApplicationSpecific app = (DERApplicationSpecific) bIn.readObject();
ASN1Sequence seq = (ASN1Sequence) app.getObject(BERTags.SEQUENCE);
Enumeration secEnum = seq.getObjects();
while (secEnum.hasMoreElements()) {
ASN1Primitive seqObj = (ASN1Primitive) secEnum.nextElement();
byte[] data = seqObj.getEncoded();
if (data[0]== 0x41) {
Log.d("type approval number", ByteUtils.bytesToHex(data));
this.set5F01(data);
} else if (data[0] == 0x42) {
byte[] input = Arrays.copyOfRange(data, 3, data.length);
parse5F02(input);
} else if (data[0] == 0x7F) {
parse7F63(data);
}
}
bIn.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例2: parseDG11
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private void parseDG11(byte[] DG11) {
try {
ASN1InputStream bIn = new ASN1InputStream(DG11);
org.bouncycastle.asn1.DERApplicationSpecific app = (DERApplicationSpecific) bIn.readObject();
ASN1Sequence seq = (ASN1Sequence) app.getObject(BERTags.SEQUENCE);
Enumeration secEnum = seq.getObjects();
while (secEnum.hasMoreElements()) {
ASN1Primitive seqObj = (ASN1Primitive) secEnum.nextElement();
byte[] data = seqObj.getEncoded();
if (data[0]== 0x7F) {
parseDG11(data);
} else if (data[0] == (byte) 0x80) {
this.setBSN(Arrays.copyOfRange(data, 2, data.length));
}
}
bIn.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例3: readObject
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
public void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
{
Object obj = in.readObject();
if (obj instanceof Hashtable)
{
this.pkcs12Attributes = (Hashtable)obj;
this.pkcs12Ordering = (Vector)in.readObject();
}
else
{
ASN1InputStream aIn = new ASN1InputStream((byte[])obj);
DERObjectIdentifier oid;
while ((oid = (DERObjectIdentifier)aIn.readObject()) != null)
{
this.setBagAttribute(oid, aIn.readObject());
}
}
}
示例4: getKeySpec
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private ASN1Primitive getKeySpec() throws NoSuchAlgorithmException,
InvalidKeySpecException, NoSuchProviderException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ASN1Primitive obj = null;
try
{
baos.write(pubkey.getEncoded());
baos.close();
ASN1InputStream derin = new ASN1InputStream(
new ByteArrayInputStream(baos.toByteArray()));
obj = derin.readObject();
}
catch (IOException ioe)
{
throw new InvalidKeySpecException(ioe.getMessage());
}
return obj;
}
示例5: readDERCertificate
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private X509AttributeCertificate readDERCertificate(
InputStream in)
throws IOException
{
ASN1InputStream dIn = new ASN1InputStream(in);
ASN1Sequence seq = (ASN1Sequence)dIn.readObject();
if (seq.size() > 1
&& seq.getObjectAt(0) instanceof DERObjectIdentifier)
{
if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
{
sData = new SignedData(ASN1Sequence.getInstance(
(ASN1TaggedObject)seq.getObjectAt(1), true)).getCertificates();
return getCertificate();
}
}
return new X509V2AttributeCertificate(seq.getEncoded());
}
示例6: readDERCertificate
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private Certificate readDERCertificate(
InputStream in)
throws IOException, CertificateParsingException
{
ASN1InputStream dIn = new ASN1InputStream(in);
ASN1Sequence seq = (ASN1Sequence)dIn.readObject();
if (seq.size() > 1
&& seq.getObjectAt(0) instanceof DERObjectIdentifier)
{
if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
{
sData = new SignedData(ASN1Sequence.getInstance(
(ASN1TaggedObject)seq.getObjectAt(1), true)).getCertificates();
return getCertificate();
}
}
return new X509CertificateObject(
org.bouncycastle.asn1.x509.Certificate.getInstance(seq));
}
示例7: readDERCRL
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private CRL readDERCRL(
ASN1InputStream aIn)
throws IOException, CRLException
{
ASN1Sequence seq = (ASN1Sequence)aIn.readObject();
if (seq.size() > 1
&& seq.getObjectAt(0) instanceof ASN1ObjectIdentifier)
{
if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
{
sCrlData = SignedData.getInstance(ASN1Sequence.getInstance(
(ASN1TaggedObject)seq.getObjectAt(1), true)).getCRLs();
return getCRL();
}
}
return createCRL(
CertificateList.getInstance(seq));
}
示例8: readDERCRL
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private CRL readDERCRL(
InputStream in)
throws IOException, CRLException
{
ASN1InputStream dIn = new ASN1InputStream(in);
ASN1Sequence seq = (ASN1Sequence)dIn.readObject();
if (seq.size() > 1
&& seq.getObjectAt(0) instanceof DERObjectIdentifier)
{
if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
{
sData = new SignedData(ASN1Sequence.getInstance(
(ASN1TaggedObject)seq.getObjectAt(1), true)).getCRLs();
return getCRL();
}
}
return new X509CRLObject(CertificateList.getInstance(seq));
}
示例9: readDERCertificate
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private java.security.cert.Certificate readDERCertificate(
ASN1InputStream dIn)
throws IOException, CertificateParsingException
{
ASN1Sequence seq = (ASN1Sequence)dIn.readObject();
if (seq.size() > 1
&& seq.getObjectAt(0) instanceof ASN1ObjectIdentifier)
{
if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
{
sData = SignedData.getInstance(ASN1Sequence.getInstance(
(ASN1TaggedObject)seq.getObjectAt(1), true)).getCertificates();
return getCertificate();
}
}
return new X509CertificateObject(
Certificate.getInstance(seq));
}
示例10: initFrom
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private void initFrom(ASN1InputStream aIS)
throws IOException
{
ASN1Primitive obj;
while ((obj = aIS.readObject()) != null)
{
if (obj instanceof DERApplicationSpecific)
{
setPrivateData((DERApplicationSpecific)obj);
}
else
{
throw new IOException("Invalid Input Stream for creating an Iso7816CertificateStructure");
}
}
}
示例11: checkConstruction
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private void checkConstruction(
DeclarationOfMajority decl,
int type,
ASN1GeneralizedTime dateOfBirth,
int notYoungerThan)
throws IOException
{
checkValues(decl, type, dateOfBirth, notYoungerThan);
decl = DeclarationOfMajority.getInstance(decl);
checkValues(decl, type, dateOfBirth, notYoungerThan);
ASN1InputStream aIn = new ASN1InputStream(decl.toASN1Primitive().getEncoded());
DERTaggedObject info = (DERTaggedObject)aIn.readObject();
decl = DeclarationOfMajority.getInstance(info);
checkValues(decl, type, dateOfBirth, notYoungerThan);
}
示例12: checkConstruction
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private void checkConstruction(
AdmissionSyntax syntax,
GeneralName authority,
ASN1Sequence admissions)
throws IOException
{
checkValues(syntax, authority, admissions);
syntax = AdmissionSyntax.getInstance(syntax);
checkValues(syntax, authority, admissions);
ASN1InputStream aIn = new ASN1InputStream(syntax.toASN1Primitive().getEncoded());
ASN1Sequence info = (ASN1Sequence)aIn.readObject();
syntax = AdmissionSyntax.getInstance(info);
checkValues(syntax, authority, admissions);
}
示例13: readObject
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
public void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
{
Object obj = in.readObject();
if (obj instanceof Hashtable)
{
this.pkcs12Attributes = (Hashtable)obj;
this.pkcs12Ordering = (Vector)in.readObject();
}
else
{
ASN1InputStream aIn = new ASN1InputStream((byte[])obj);
ASN1ObjectIdentifier oid;
while ((oid = (ASN1ObjectIdentifier)aIn.readObject()) != null)
{
this.setBagAttribute(oid, aIn.readObject());
}
}
}
示例14: getSubjectX509Principal
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
/**
* return the subject of the given cert as an X509PrincipalObject.
*/
public static X509Principal getSubjectX509Principal(
X509Certificate cert)
throws CertificateEncodingException
{
try
{
ByteArrayInputStream bIn = new ByteArrayInputStream(
cert.getTBSCertificate());
ASN1InputStream aIn = new ASN1InputStream(bIn);
TBSCertificateStructure tbsCert = new TBSCertificateStructure(
(ASN1Sequence)aIn.readObject());
return new X509Principal(tbsCert.getSubject());
}
catch (IOException e)
{
throw new CertificateEncodingException(e.toString());
}
}
示例15: checkConstruction
import org.bouncycastle.asn1.ASN1InputStream; //導入方法依賴的package包/類
private void checkConstruction(
NamingAuthority auth,
ASN1ObjectIdentifier namingAuthorityID,
String namingAuthorityURL,
DirectoryString namingAuthorityText)
throws IOException
{
checkValues(auth, namingAuthorityID, namingAuthorityURL, namingAuthorityText);
auth = NamingAuthority.getInstance(auth);
checkValues(auth, namingAuthorityID, namingAuthorityURL, namingAuthorityText);
ASN1InputStream aIn = new ASN1InputStream(auth.toASN1Primitive().getEncoded());
ASN1Sequence seq = (ASN1Sequence)aIn.readObject();
auth = NamingAuthority.getInstance(seq);
checkValues(auth, namingAuthorityID, namingAuthorityURL, namingAuthorityText);
}