public byte[] ComputeHash(byte[] data) { using (var facade = new GostCryptFacade(ProviderParams)) { facade.AcquireContext(null, Constants.CryptVerifycontext); using (HashContext hashContext = facade.CreateHash(null, 0)) { hashContext.AddData(data, 0); return(hashContext.GetValue()); } } }
public bool VerifyCertificate( byte[] signature, byte[] data, byte[] certificateData) { using (var facade = new GostCryptFacade(ProviderParams)) { facade.AcquireContext(null, Constants.CryptVerifycontext); using (KeyContext keyContext = facade.ImportSertificate(certificateData)) { using (HashContext hashContext = facade.CreateHash(null, 0)) { hashContext.AddData(data, 0); return(keyContext.VerifySignature(signature, hashContext, 0)); } } } }