/// <summary>
 ///     Проверка подписи.
 /// </summary>
 /// <param name="request">Данные.</param>
 /// <returns>True - провека прошла успешно, иначе False.</returns>
 public bool VerifySignature(VerifySignatureRequest request)
 {
     log.Debug("VerifySignature: {0}", request);
     byte[] signatureValue = Convert.FromBase64String(request.Signature);
     byte[] dataValue      = Encoding.UTF8.GetBytes(request.Data);
     byte[] publicKeyValue = Convert.FromBase64String(request.PublicKey);
     return(KeyContainer.VerifySignature(signatureValue, dataValue, publicKeyValue));
 }
示例#2
0
        public void SignHash()
        {
            byte[] data = GetRandomData();

            byte[] signature;
            byte[] hash = KeyContainer.ComputeHash(data);

            using (KeyContainer keyContainer = KeyContainer.Open(Container, ContainerPassword))
            {
                signature = keyContainer.SignHash(hash, KeyNumber.Signature);
            }

            byte[] publicKey = KeyContainer.ExportPublicKey(Container);
            bool   result    = KeyContainer.VerifySignature(signature, data, publicKey);

            Assert.IsTrue(result);
        }