您必须使用oid手动构建属性,如下所示:
ObjectIdentifier dnOid = new ObjectIdentifier("1.3.6.1.4.1.311.88.2.1");
ObjectIdentifier ddOid = new ObjectIdentifier("1.3.6.1.4.1.311.88.2.2");
ASN1Set nameSet = new DERSet(new ASN1Encodable[] {new DERPrintableString("name")});
ASN1Set descriptionSet = new DERSet(new ASN1Encodable[] {new DERPrintableString("description"}));
Attribute documentName = new Attribute(dnOid, nameSet);
Attribute documentDescription = new Attribute(ddOid, descriptionSet);
我应该指出使用
DERPrintableString
因为属性值是我最好的猜测。我找不到指示正确类型的文档。
至于
你应该
,好吧,使用不是来自
PKCS #9
. 你不应该依赖外部系统来使用它们。