locked
Error "0x80090022 Provider could not perform the action since the context was acquired as silent" trying to create a certificate RRS feed

  • Question

  • Hi, i'm trying to create a certificate with certenroll, but when i try to create it i get the Error "0x80090022 Provider could not perform the action since the context was acquired as silent", here is the code i'm using

     

    In the page:

     

    Code Block
    <OBJECT id="g_objClassFactory" CLASSID="clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"></object>

     

     

     

    In Javascript:

     

    Code Block

     

       var obj=g_objClassFactory.CreateObject("X509Enrollment.CX509Enrollment");
       var objPrivateKey=g_objClassFactory.CreateObject("X509Enrollment.CX509PrivateKey");
       var objRequest=g_objClassFactory.CreateObject("X509Enrollment.CX509CertificateRequestPkcs10");
       var csps = g_objClassFactory.CreateObject("X509Enrollment.CCspInformations");
       var objDN = g_objClassFactory.CreateObject("X509Enrollment.CX500DistinguishedName");
       csps.AddAvailableCsps();

       var provider=csps.ItemByIndex(12);

       objPrivateKey.ProviderType = provider.Type;
       objPrivateKey.ProviderName = provider.Name
       objPrivateKey.KeySpec = "1";
       objRequest.InitializeFromPrivateKey(1, objPrivateKey, "");
       objDN.Encode(szName,0);

       objRequest.Subject=objDN;

       obj.InitializeFromRequest(objRequest);

       sz10=obj.CreateRequest(1);

     

     

    What's the meaning of "acquired as silent"?, the only "silent" i've seen in certenroll is the silent property of the certificate request but when i try to set it i get an Access denied error.

    Any idea how to fix this?

     

    Thanks..
    Wednesday, November 21, 2007 8:55 AM

Answers


  • Found the answer... just list the providers, find it by it's name and asign it to the private key

    Code Block
    var selectedProvider = g_objClassFactory.CreateObject("X509Enrollment.CCspInformation");
    selectedProvider.InitializeFromName(providerName);
    privateKey.CspInformations = g_objClassFactory.CreateObject("X509Enrollment.CCspInformations");
    privateKey.CspInformations.Add(selectedProvider);


    Saturday, January 19, 2008 2:03 AM

All replies

  • More info, i've found that if i use this provider it seems to work:

    objPrivateKey.ProviderName = "Microsoft Enhanced RSA and AES Cryptographic Provider";
    objPrivateKey.ProviderType = "24";

     

    But i have to use:

    SafeSign Standard Cryptographic Service Provider

    Type: 1

     

    When i use it i get the "silent" exception...

    Thursday, November 22, 2007 2:35 AM

  • Found the answer... just list the providers, find it by it's name and asign it to the private key

    Code Block
    var selectedProvider = g_objClassFactory.CreateObject("X509Enrollment.CCspInformation");
    selectedProvider.InitializeFromName(providerName);
    privateKey.CspInformations = g_objClassFactory.CreateObject("X509Enrollment.CCspInformations");
    privateKey.CspInformations.Add(selectedProvider);


    Saturday, January 19, 2008 2:03 AM