Re: CryptAcquireContext fails with error (8009000F)

From: Sergio Dutra [MS] (sergio_at_online.microsoft.com)
Date: 05/11/04


Date: Tue, 11 May 2004 09:38:51 -0700

It usually means you already have that container name but it was not created
by you and you do not have permissions on it. Hence, when you try to acquire
a context without any keyset flags it will give you bad keyset, but when you
try to create the keyset CryptAcquireContext will return that it already
exists.

You will need to try a different key container name.

-- 
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"sachin" <mishraiisc@hotmail.com> wrote in message 
news:uagw$byNEHA.3380@TK2MSFTNGP11.phx.gbl...
>I am running the following code on XP machines. On some of the machines it
> gives error 8009000F at the place that I have marked in the code ###. 
> Error
> description says "Object already exists." When does this error occur?
>
> LPCSTR UserName = "MyName";
>
> if (RCRYPT_FAILED(CryptAcquireContext(&hCryptProv, UserName,
> MS_ENHANCED_PROV,  PROV_RSA_FULL, 0) ) ){
>    if(GetLastError() == NTE_BAD_KEYSET){
>        if (RCRYPT_FAILED(CryptAcquireContext(&hCryptProv, UserName,
> MS_ENHANCED_PROV,
>
> PROV_RSA_FULL, CRYPT_NEWKEYSET) ) ){
>                 printf("Could not get crypto context %x",GetLastError() );
> #############ERROR###########
>        }
>        else{
>            return TRUE;
>       }
>   }
> }
> else{
>    return TRUE;
> }
> return FALSE;
>
>
>
> Thanks,
> Sachin
>
> 


Relevant Pages

  • Re: CryptAcquireContext fails with error (8009000F)
    ... If I am using the application from some shared server ... the container in Microsoft/Crypto directory and I was able to open or delete ... > a context without any keyset flags it will give you bad keyset, ... >>I am running the following code on XP machines. ...
    (microsoft.public.platformsdk.security)
  • Re: Moving Shop
    ... Plan out the load so it's close to balanced as well. ... Just have a wireframe box of the interior dims of the container along with all the interior tie down points, but drawing exterior dims of major machines and cabinets in solids. ... Have been advised that the cleaner my container looks when opened, the less likely Australian Customs will want to do a full unload. ...
    (rec.crafts.metalworking)
  • Re: Moving Shop
    ... Plan out the load so it's close to balanced as well. ... have a workable floor plan call for your container. ... machines and cabinets in solids. ... less likely Australian Customs will want to do a full unload. ...
    (rec.crafts.metalworking)
  • Re: Join a PC to a specific OU?
    ... A new feature in Windows 2003 is you can redirect the Computers container to ... Since I'm doing the domain join as part of an unattended build, ... > should be the default container/OU to add machines to. ...
    (microsoft.public.win2000.setup_deployment)
  • Re: "Keyset does not exist" after change password
    ... This is most likely related to DPAPI not being able to decrypt the container ... CryptAcquireContext to open my keyset. ... > Whenever the user changes their domain password, ...
    (microsoft.public.platformsdk.security)

Loading