1

我需要从 CA 服务器获取 X509Certificate

我需要添加一些 EnhancedKeyUsage 扩展,例如“secureEmail”-“1.3.6.1.5.5.7.3.4”

如何将其添加到证书请求中?

以下代码运行,返回证书但没有想要的扩展

ASN1EncodableVector secureEmail = new ASN1EncodableVector();
secureEmail.add(new DERObjectIdentifier("1.3.6.1.5.5.7.3.4"));
secureEmail.add(new DERTaggedObject(true, 0, new DERUTF8String( "secureEmail")));
genName = new DERTaggedObject(false, 0, new DERSequence(secureEmail));
genNames = new ASN1EncodableVector();
genNames.add(genName);
extGen=new ExtensionsGenerator(); //??????
extGen.addExtension(new ASN1ObjectIdentifier("1.3.6.1.5.5.7.3.4"), true, new DERSequence(genNames));
    csrBuilder.addAttribute(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest,extGen.generate());
4

0 回答 0