IntPtr hCryptProv;
IntPtr hKey = (IntPtr)0;
IntPtr hHash;
string encrString= GetEncryptedConnectionString();
decodedBytes = Convert.FromBase64String(encrString);
decodedBytesLength = decodedBytes.Length;
ePasswordBytes = Encoding.UTF8.GetBytes(ePassword);
// Get a handle to the default provider.
if (!CryptAcquireContext(out hCryptProv, null, null, PROV_RSA_FULL, 0))
{
int error = Marshal.GetLastWin32Error();
uint error1 = Convert.ToUInt32(error );
if (error1 == NTE_BAD_KEYSET)
{
if (!CryptAcquireContext(out hCryptProv, null, null, PROV_RSA_FULL, 8))
if (!CryptAcquireContext(out hCryptProv, null, null, PROV_RSA_FULL, CRYPT_NEWKEYSET))
{
messagebox.show "CryptAcquireContext failed";
}
}
else
{
messagebox.show "CryptAcquireContext failed";
}
}
In the above code error1 value is coming 1150 error code
So please help me why