caps.addCapability(SMIMECapability.rC2_CBC, 128);
caps.addCapability(SMIMECapability.dES_CBC);
SMIMECapabilitiesAttribute attr = new SMIMECapabilitiesAttribute(caps);
SMIMEEncryptionKeyPreferenceAttribute pref = new SMIMEEncryptionKeyPreferenceAttribute(
new RecipientKeyIdentifier(new DEROctetString(new byte[8]), new DERGeneralizedTime(new Date(1000)), null));
try
{
if (!isSameAs(attr.getEncoded(), attrBytes))
{
return new SimpleTestResult(false, getName() + ": Failed attr data check");
}
ByteArrayInputStream bIn = new ByteArrayInputStream(attrBytes);
ASN1InputStream aIn = new ASN1InputStream(bIn);
DERObject o = aIn.readObject();
if (!attr.equals(o))
{
return new SimpleTestResult(false, getName() + ": Failed equality test for attr");
}
if (!isSameAs(pref.getEncoded(), prefBytes))
{
return new SimpleTestResult(false, getName() + ": Failed attr data check");
}
bIn = new ByteArrayInputStream(prefBytes);
aIn = new ASN1InputStream(bIn);
o = aIn.readObject();
if (!pref.equals(o))
{
return new SimpleTestResult(false, getName() + ": Failed equality test for pref");
}
return new SimpleTestResult(true, getName() + ": Okay");