Abdumalik Nabiev
Abdumalik Nabiev

Reputation: 311

CertEnrol import pfx The password you entered is incorrect

I'm created pfx certificate using by certEntroll when I imported on windows 10 it's imported successfuly but when i tried on windwos 7 i got an error "The password you entered is incorrect" How do fix it? This is part of code how i create PFX from CA

 var objCertRequest = new CCertRequest();
        var iDisposition = objCertRequest.RetrievePending(requestId, caIP + @"\" + caNAme);

        if (iDisposition == CR_DISP_ISSUED)
        {
            var cert = objCertRequest.GetCertificate(CR_OUT_BASE64 | CR_OUT_CHAIN);
            var objEnroll = new CX509Enrollment();
            objEnroll.Initialize(X509CertificateEnrollmentContext.ContextUser);
            objEnroll.InstallResponse(
                  InstallResponseRestrictionFlags.AllowUntrustedRoot,
                 cert,
                 EncodingType.XCN_CRYPT_STRING_BASE64, password);
            var certResponce = objEnroll.CreatePFX(password, PFXExportOptions.PFXExportChainNoRoot);
        }

Upvotes: 0

Views: 3252

Answers (1)

FluffyBike
FluffyBike

Reputation: 2322

I know this post is a about a year old, but I just had the same error on a similar issue. In my case I had used OpenSSL 3.0.0 to create the .pfx file. I could import the .pfx file on Windows 10, but got an error on Windows Server 2012. OpenSSL apparently uses some default settings that are not supported on older versions of Windows. When I used OpenSSL 1.1.1 it worked fine.

My issue was on Windows Server 2012, but I just tested Windows 7 and it was the same issue there.

Upvotes: 2

Related Questions