v.add(version);
if (originatorInfo != null)
{
v.add(new DERTaggedObject(false, 0, originatorInfo));
}
v.add(recipientInfos);
v.add(authEncryptedContentInfo);
// "authAttrs optionally contains the authenticated attributes."
if (authAttrs != null)
{
// "AuthAttributes MUST be DER encoded, even if the rest of the
// AuthEnvelopedData structure is BER encoded."
v.add(new DERTaggedObject(false, 1, authAttrs));
}
v.add(mac);
// "unauthAttrs optionally contains the unauthenticated attributes."
if (unauthAttrs != null)
{
v.add(new DERTaggedObject(false, 2, unauthAttrs));
}
return new BERSequence(v);
}