protected java.util.Hashtable | createStandardAttributeTable(java.util.Map parameters)Create a standard attribute table from the passed in parameters - this will
normally include contentType, signingTime, and messageDigest. If the constructor
using an AttributeTable was used, entries in it for contentType, signingTime, and
messageDigest will override the generated ones.
Hashtable std = (Hashtable)table.clone();
if (!std.containsKey(CMSAttributes.contentType))
{
Attribute attr = new Attribute(CMSAttributes.contentType,
new DERSet((DERObjectIdentifier)parameters.get(CMSAttributeTableGenerator.CONTENT_TYPE)));
std.put(attr.getAttrType(), attr);
}
if (!std.containsKey(CMSAttributes.signingTime))
{
Attribute attr = new Attribute(CMSAttributes.signingTime, new DERSet(new Time(new Date())));
std.put(attr.getAttrType(), attr);
}
if (!std.containsKey(CMSAttributes.messageDigest))
{
byte[] hash = (byte[])parameters.get(CMSAttributeTableGenerator.DIGEST);
Attribute attr;
if (hash != null)
{
attr = new Attribute(CMSAttributes.messageDigest, new DERSet(new DEROctetString(hash)));
}
else
{
attr = new Attribute(CMSAttributes.messageDigest, new DERSet(new DERNull()));
}
std.put(attr.getAttrType(), attr);
}
return std;
|