证书注册Win 2003 Server ASP.NET应用程序中的错误 [英] Error in Certificate Enrollment Win 2003 Server ASP.NET Application

查看:69
本文介绍了证书注册Win 2003 Server ASP.NET应用程序中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有,



我的证书申请/注册有问题。我收到此错误:

Hey all,

I have a problem with the certificate request/enrollment. I get this error:

CertEnroll::CX509Enrollment::_EnrollWizard: The system cannot find the file specified. 0x80070002 (WIN32: 2)





我必须为其他用户创建证书,因此我使用基本身份验证,因为委派和假冒以登录的用户身份申请证书。



如果我向我正在开发和发布的域用户请求证书,我会获得正确的证书。当我与其他用户发布解决方案时,我也可以为该用户请求证书。如果是其他用户,我会收到错误消息。



头等舱:



I have to create a certificate for another user, so I use basic authentication, because of delegation and impersonation to request the certificate as the user, who is logged on.

If I request a certificate with the domain user I am developing and publishing I get the right certificate. When I publish the solution with another user, I can request the certificate also for this user. If it is an other user I get the error.

First class:

WindowsIdentity wi = (WindowsIdentity)User.Identity;
         
            String templateName = "ADI01Smartphone";
            String user = User.Identity.Name.Split(new Char[] { '\\' })[1];
            String subjectName = "CN=" + user;
            String friendlyName = user + "Cert";
            WindowsImpersonationContext wic = null;
            try
            {
                wic = wi.Impersonate();
                EnrollCertificate.EnrollCert(templateName, subjectName, friendlyName, wi);
            }
            finally
            {
                if (wic != null)
                {
                    wic.Undo();
                }
            }







证书申请:






The certificate request:

class EnrollCertificate
    {
        public static void EnrollCert(
            string templateName,
            string subjectName,
            string friendlyName,
            WindowsIdentity wi)
        {
            // create a CX509Enrollment object
            CX509Enrollment objEnroll = new CX509Enrollment();
           
            // initialize the CX509Enrollment object from template
            objEnroll.InitializeFromTemplateName(
                X509CertificateEnrollmentContext.ContextUser,
                templateName);
            
            // first get the request
            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;

            // set up friendly name
            objEnroll.CertificateFriendlyName = friendlyName;

            // enroll for the certificate, which should install the certficate
            // in store if the certificate is successfully issued by CA
            objEnroll.Enroll();
            
        }
    }





我不知道出了什么问题。

您有什么想法吗?



I don´t know what is wrong.
Have you got any idea?

推荐答案

查看这些链接



http://technet.microsoft.com/en-us/library/ff182343(WS .10).aspx [ ^ ]



http://social.msdn.microsoft.com/Forums/hu-HU/csharpgeneral/thread/e6135568-48cc-44e0-b8c2-ac2964e69db5 [<一个href =http://social.msdn.microsoft.com/Forums/hu-HU/csharpgeneral/thread/e6135568-48cc-44e0-b8c2-ac2964e69db5\"target =_ blanktitle =New Window> ^ ]



http:/ /www.msdotnet.org/Certificate-Enrollment-in-C-t342240.html [ ^ ]



希望它有帮助,< br $> b $ b

请投票支持,



谢谢,
check these links

http://technet.microsoft.com/en-us/library/ff182343(WS.10).aspx[^]

http://social.msdn.microsoft.com/Forums/hu-HU/csharpgeneral/thread/e6135568-48cc-44e0-b8c2-ac2964e69db5[^]

http://www.msdotnet.org/Certificate-Enrollment-in-C-t342240.html[^]

hope it helps,,

please vote for effort,,

thanks,


您没有私钥 - 系统找不到指定的文件。
You don't have a private key in place - The system cannot find the file specified.


这篇关于证书注册Win 2003 Server ASP.NET应用程序中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆