public byte[] GetCertificatePublicKey(byte[] certificateData) { using (var facade = new InfotecsFacade(ProviderParams)) { facade.AcquireContext(null, Constants.CryptVerifycontext); using (KeyContext keyContext = facade.ImportSertificate(certificateData)) { return(keyContext.ExportPublicKey()); } } }
public bool VerifyCertificate( byte[] signature, byte[] data, byte[] certificateData) { using (var facade = new InfotecsFacade(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)); } } } }