/// <summary> /// Проверка подписи. /// </summary> /// <param name="request">Данные.</param> /// <returns>True - провека прошла успешно, иначе False.</returns> public bool VerifyCertificate(VerifySignatureCertRequest request) { log.Debug("VerifySignatureSert: {0}", request); byte[] signatureValue = Convert.FromBase64String(request.Signature); byte[] dataValue = Encoding.UTF8.GetBytes(request.Data); byte[] certificateValue = Convert.FromBase64String(request.Certificate); return(KeyContainer.VerifyCertificate(signatureValue, dataValue, certificateValue)); }
public void SignCertigicateSignature() { byte[] data = GetRandomData(); byte[] signature, certificateRawData; byte[] hash = KeyContainer.ComputeHash(data); using (KeyContainer keyContainer = KeyContainer.Open(ContainerSert, ContainerPassword)) { signature = keyContainer.SignHash(hash, KeyNumber.Signature); certificateRawData = keyContainer.ExportCertificateData(); } bool result = KeyContainer.VerifyCertificate(signature, data, certificateRawData); Assert.IsTrue(result); }