Esempio n. 1
0
 public static int GetUserKey(SafeProvHandleImpl providerHandle, int keyNumber, ref SafeKeyHandleImpl keyHandle)
 {
     if (!CryptoApi.CryptGetUserKey(providerHandle, (uint)keyNumber, ref keyHandle))
     {
         return(Marshal.GetLastWin32Error());
     }
     return(0);
 }
Esempio n. 2
0
        public static SafeKeyHandleImpl GetUserKey(SafeProvHandleImpl providerHandle, int keyNumber)
        {
            var keyHandle = SafeKeyHandleImpl.InvalidHandle;

            if (!CryptoApi.CryptGetUserKey(providerHandle, (uint)keyNumber, ref keyHandle))
            {
                throw CreateWin32Error();
            }

            return(keyHandle);
        }