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."); } }