Java 类org.bouncycastle.asn1.DERSequenceParser 实例源码

项目:CryptMeme    文件:PKCS12StoreTest.java   
public void performTest()
    throws Exception
{
    testPKCS12Store();
    testGOSTStore();

    // converter tests

    KeyStore kS = KeyStore.getInstance("PKCS12", "BC");

    byte[] data = PKCS12Util.convertToDefiniteLength(pkcs12);
    kS.load(new ByteArrayInputStream(data), passwd);     // check MAC

    ASN1Encodable obj = new ASN1StreamParser(data).readObject();
    if (!(obj instanceof DERSequenceParser))
    {
        fail("Failed DER conversion test.");
    }

    data = PKCS12Util.convertToDefiniteLength(pkcs12, passwd, "BC");
    kS.load(new ByteArrayInputStream(data), passwd); //check MAC

    obj = new ASN1StreamParser(data).readObject();
    if (!(obj instanceof DERSequenceParser))
    {
        fail("Failed deep DER conversion test - outer.");
    }

    Pfx pfx = Pfx.getInstance(obj);

    obj = new ASN1StreamParser(ASN1OctetString.getInstance(pfx.getAuthSafe().getContent()).getOctets()).readObject();
    if (!(obj instanceof DERSequenceParser))
    {
        fail("Failed deep DER conversion test - inner.");
    }
}
项目:irma_future_id    文件:PKCS12StoreTest.java   
public void performTest()
    throws Exception
{
    testPKCS12Store();
    testGOSTStore();

    // converter tests

    KeyStore kS = KeyStore.getInstance("PKCS12", "BC");

    byte[] data = PKCS12Util.convertToDefiniteLength(pkcs12);
    kS.load(new ByteArrayInputStream(data), passwd);     // check MAC

    ASN1Encodable obj = new ASN1StreamParser(data).readObject();
    if (!(obj instanceof DERSequenceParser))
    {
        fail("Failed DER conversion test.");
    }

    data = PKCS12Util.convertToDefiniteLength(pkcs12, passwd, "BC");
    kS.load(new ByteArrayInputStream(data), passwd); //check MAC

    obj = new ASN1StreamParser(data).readObject();
    if (!(obj instanceof DERSequenceParser))
    {
        fail("Failed deep DER conversion test - outer.");
    }

    Pfx pfx = Pfx.getInstance(obj);

    obj = new ASN1StreamParser(ASN1OctetString.getInstance(pfx.getAuthSafe().getContent()).getOctets()).readObject();
    if (!(obj instanceof DERSequenceParser))
    {
        fail("Failed deep DER conversion test - inner.");
    }
}
项目:bc-java    文件:PKCS12StoreTest.java   
public void performTest()
    throws Exception
{
    testPKCS12Store();
    testGOSTStore();

    // converter tests

    KeyStore kS = KeyStore.getInstance("PKCS12", "BC");

    byte[] data = PKCS12Util.convertToDefiniteLength(pkcs12);
    kS.load(new ByteArrayInputStream(data), passwd);     // check MAC

    ASN1Encodable obj = new ASN1StreamParser(data).readObject();
    if (!(obj instanceof DERSequenceParser))
    {
        fail("Failed DER conversion test.");
    }

    data = PKCS12Util.convertToDefiniteLength(pkcs12, passwd, "BC");
    kS.load(new ByteArrayInputStream(data), passwd); //check MAC

    obj = new ASN1StreamParser(data).readObject();
    if (!(obj instanceof DERSequenceParser))
    {
        fail("Failed deep DER conversion test - outer.");
    }

    Pfx pfx = Pfx.getInstance(obj);

    obj = new ASN1StreamParser(ASN1OctetString.getInstance(pfx.getAuthSafe().getContent()).getOctets()).readObject();
    if (!(obj instanceof DERSequenceParser))
    {
        fail("Failed deep DER conversion test - inner.");
    }
}