Exemplo n.º 1
0
        public override bool VerifyHash(byte[] hash, byte[] signature)
        {
            if (hash == null)
            {
                throw new ArgumentNullException("hash");
            }
            if (signature == null)
            {
                throw new ArgumentNullException("signature");
            }
            new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert();
            SafeNCryptKeyHandle key = this.Key.Handle;

            CodeAccessPermission.RevertAssert();
            return(NCryptNative.VerifySignature(key, hash, signature));
        }
Exemplo n.º 2
0
        public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
        {
            if (rgbHash == null)
            {
                throw new ArgumentNullException("rgbHash");
            }

            if (rgbSignature == null)
            {
                throw new ArgumentNullException("rgbSignature");
            }

            rgbHash = AdjustHashSizeIfNecessary(rgbHash);

            return(NCryptNative.VerifySignature(KeyHandle, rgbHash, rgbSignature));
        }
Exemplo n.º 3
0
        public override bool VerifyHash(byte[] hash, byte[] signature)
        {
            if (hash == null)
            {
                throw new ArgumentNullException("hash");
            }
            if (signature == null)
            {
                throw new ArgumentNullException("signature");
            }

            // We need to get the raw key handle to verify the signature. Asserting here is safe since verifiation
            // is not a protected operation, and we do not expose the handle to the user code.
            new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert();

            // This looks odd, but Key.Handle is really a duplicate so we need to dispose it
            using (SafeNCryptKeyHandle keyHandle = Key.Handle) {
                CodeAccessPermission.RevertAssert();

                return(NCryptNative.VerifySignature(keyHandle, hash, signature));
            }
        }