Cryptography (wincrypt.h): Error 80090016 ??

This is a discussion on Cryptography (wincrypt.h): Error 80090016 ?? within the C Programming forums, part of the General Programming Boards category; Greetings to all, I program C on a windows platform (windows XP). I would like to incoporate encryption functions in ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    22

    Cryptography (wincrypt.h): Error 80090016 ??

    Greetings to all,

    I program C on a windows platform (windows XP). I would like to incoporate encryption functions in some of my programs however,
    whenever I call CryptAcquireContext(), I get the above error i.e
    (80090016) as below:

    cut here--------------------------------
    /* Other initialization code...... */
    HCRYPTPROV hProv = 0;

    if(!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0)) {
    printf("Error %x during CryptAcquireContext!\n", GetLastError());
    return 0;
    }

    /* Program continues....... */
    ---------------------------------
    The same thing happens when I download sample programs from the msdn site.
    The output of the program is always:

    "Error 80090016 during CryptAcquireContext!"

    Anyone have an idea about how to overcome this?
    Gerald.
    -------------------------
    Gerald.

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    22

    Re: Cryptography (wincrypt.h): Error 80090016 ??

    Uh...Jus found the problem, the error "80080016" is NTE_BAD_KEYSET.

    I have now modified my code to:

    --------------------------------------------------
    if((CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0) == NTE_BAD_KEYSET) {
    if(!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
    printf("Error %x during CryptAcquireContext!\n", GetLastError());
    exit(0);
    }
    }
    --------------------------------------------------

    works fine.
    -------------------------
    Gerald.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cryptography
    By freddyvorhees in forum C++ Programming
    Replies: 12
    Last Post: 08-15-2008, 10:03 PM
  2. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  3. Cryptography and Compression
    By gogo in forum C++ Programming
    Replies: 1
    Last Post: 10-26-2003, 10:24 AM
  4. cryptography
    By tsarena in forum C++ Programming
    Replies: 2
    Last Post: 06-05-2002, 05:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21