public void GetCertificatePublicKey() { using (KeyContainer keyContainer = KeyContainer.Open(ContainerSert, ContainerPassword)) { var certificateRawData = keyContainer.ExportCertificateData(); var publicKeyFromCert = KeyContainer.GetCertificatePublicKey(certificateRawData); var containerKey = keyContainer.ExportPublicKey(); Assert.AreEqual(containerKey, publicKeyFromCert); } }
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); }
/// <summary> /// Экспорт сертификата из контейнера. /// </summary> public string ExportCertificate() { log.Debug("ExportCertificateData: keyContainerName: {0}", Container); return(Convert.ToBase64String(KeyContainer.ExportCertificateData(Container))); }
public void ExportCertificate() { byte[] certificate = KeyContainer.ExportCertificateData(ContainerSert); CollectionAssert.IsNotEmpty(certificate); }