keyIdentifier = (ASN1OctetString)seq.getObjectAt(0);
switch (seq.size())
{
case 1:
break;
case 2:
if (seq.getObjectAt(1) instanceof DERGeneralizedTime)
{
date = (DERGeneralizedTime)seq.getObjectAt(1);
}
else
{
other = OtherKeyAttribute.getInstance(seq.getObjectAt(1));
}
break;
case 3:
date = (DERGeneralizedTime)seq.getObjectAt(1);
other = OtherKeyAttribute.getInstance(seq.getObjectAt(2));
break;
default:
throw new IllegalArgumentException("Invalid KEKIdentifier");
}
Produce an object suitable for an ASN1OutputStream.
KEKIdentifier ::= SEQUENCE {
keyIdentifier OCTET STRING,
date GeneralizedTime OPTIONAL,
other OtherKeyAttribute OPTIONAL
}
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(keyIdentifier);
if (date != null)
{
v.add(date);
}
if (other != null)
{
v.add(other);
}
return new DERSequence(v);