Exemple #1
0
 public static void SetKeyParameter(SafeKeyHandleImpl keyHandle, int keyParamId, byte[] keyParamValue)
 {
     if (!CryptoApi.CryptSetKeyParam(keyHandle, (uint)keyParamId, keyParamValue, 0))
     {
         throw CreateWin32Error();
     }
 }
Exemple #2
0
        private static void SetKeyParameterString(SafeKeyHandleImpl keyHandle, int keyParamId, string keyParamValue)
        {
            var stringDataBytes = Encoding.GetEncoding(0).GetBytes(keyParamValue);

            if (!CryptoApi.CryptSetKeyParam(keyHandle, (uint)keyParamId, stringDataBytes, 0))
            {
                throw CreateWin32Error();
            }
        }
Exemple #3
0
        public static void SetKeyParameterInt32(SafeKeyHandleImpl keyHandle, int keyParamId, int keyParamValue)
        {
            var dwDataBytes = BitConverter.GetBytes(keyParamValue);

            if (!CryptoApi.CryptSetKeyParam(keyHandle, (uint)keyParamId, dwDataBytes, 0))
            {
                throw CreateWin32Error();
            }
        }