I am trying to change key ID (Key name), I am using NCrypt: First I am calling NCryptOpenStorageProvider to initialize provider handle, after that I am calling NcryptOpenKey to initialize key handle this functions works well without errors.
After that I call NCryptSetProperty
string name = "keyName";
byte[] nameBytes = System.Text.Encoding.UTF8.GetBytes(name);
uint ret = NCryptSetProperty(Key Handle, NCRYPT_NAME_PROPERTY, nameBytes, (uint)nameBytes.Length,0);
If(ret != ERROR_SUCCESS)
{
Console.WriteLine(ret.toString());
}
I got error 0x80090027 INVALID Parameter.
Do you have any idea? I suspect in the convertion from string to byte array, but I tried using also ascii and got same error.
User contributions licensed under CC BY-SA 3.0