encInfo = new EncryptedPrivateKeyInfo(encInfo.getEncryptionAlgorithm(), encInfo.getEncryptedData());
b = new SafeBag(PKCSObjectIdentifiers.pkcs8ShroudedKeyBag, encInfo.toASN1Object(), b.getBagAttributes());
ByteArrayOutputStream abOut = new ByteArrayOutputStream();
ASN1OutputStream berOut = new ASN1OutputStream(abOut);
berOut.writeObject(new DERSequence(b));
c[0] = new ContentInfo(PKCSObjectIdentifiers.data, new BERConstructedOctetString(abOut.toByteArray()));
//
// certificates
//
if (!c[1].getContentType().equals(PKCSObjectIdentifiers.encryptedData))
{
return new SimpleTestResult(false, getName() + ": failed comparison encryptedData test");
}
EncryptedData eData = EncryptedData.getInstance(c[1].getContent());
c[1] = new ContentInfo(PKCSObjectIdentifiers.encryptedData, eData);
//
// create an octet stream represent the BER encoding of authSafe
//
authSafe = new AuthenticatedSafe(c);
abOut = new ByteArrayOutputStream();
berOut = new ASN1OutputStream(abOut);
berOut.writeObject(authSafe);
info = new ContentInfo(PKCSObjectIdentifiers.data, new BERConstructedOctetString(abOut.toByteArray()));
mData = new MacData(new DigestInfo(algId, dInfo.getDigest()), salt, itCount);
bag = new Pfx(info, mData);
//
// comparison test
//
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream aOut = new ASN1OutputStream(bOut);
aOut.writeObject(bag);
if (!isSameAs(bOut.toByteArray(), pkcs12))
{
return new SimpleTestResult(false, getName() + ": failed comparison test");
}