Пример #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);
 }
Пример #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);
        }