在 CERTENROLL 请求中提供公钥

发布于 2024-11-02 23:14:23 字数 882 浏览 0 评论 0原文

我想使用模板请求证书(从 AD 证书服务器)。我想在请求中提供公钥。使用 msft 的 SDK 示例,

        IX509CertificateRequest iRequest = objEnroll.Request;

        // then get the inner PKCS10 request
        IX509CertificateRequest iInnerRequest = 
            iRequest.GetInnerRequest(InnerRequestLevel.LevelInnermost);
        IX509CertificateRequestPkcs10 iRequestPkcs10 = 
            iInnerRequest as IX509CertificateRequestPkcs10;

        // create CX500DistinguishedName
        CX500DistinguishedName objName = new CX500DistinguishedName();
        objName.Encode(subjectName, X500NameFlags.XCN_CERT_NAME_STR_NONE);

        // set up the subject name
        iRequestPkcs10.Subject = objName;

我想我需要做一些类似的事情

         iRequestPkcs10.PublicKey.InitializeFromEncodedPublicKeyInfo(xx);

,但我不知道 xx 是什么。我有公钥(在充气城堡 PKCS10 对象中),但它必须采用什么格式才能传递给此函数?

I want to request a cert (from AD cert server) using a template. I want to supply the public key in the request. Using msft's SDK sample

        IX509CertificateRequest iRequest = objEnroll.Request;

        // then get the inner PKCS10 request
        IX509CertificateRequest iInnerRequest = 
            iRequest.GetInnerRequest(InnerRequestLevel.LevelInnermost);
        IX509CertificateRequestPkcs10 iRequestPkcs10 = 
            iInnerRequest as IX509CertificateRequestPkcs10;

        // create CX500DistinguishedName
        CX500DistinguishedName objName = new CX500DistinguishedName();
        objName.Encode(subjectName, X500NameFlags.XCN_CERT_NAME_STR_NONE);

        // set up the subject name
        iRequestPkcs10.Subject = objName;

I think I then need to do some thing like this

         iRequestPkcs10.PublicKey.InitializeFromEncodedPublicKeyInfo(xx);

but I dont know what xx is. I have the public key (In a bouncy castle PKCS10 object), but what format must it be in to pass to this function?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以酷 2024-11-09 23:14:23

您可以采用多种不同的格式指定公钥。

根据 MSDN,InitializeFromEncodedPublicKeyInfo 需要两个参数:第一个是公钥,第二个是EncodingType 枚举值,指定您提供的公钥。

You can specify the public key in a number of different formats.

According to MSDN, InitializeFromEncodedPublicKeyInfo takes two parameters: the first is the public key, and the second is an EncodingType enumeration value that specifies the format of the public key you are supplying.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文