/// <summary> /// Расчитать HASH /// </summary> /// <param name="cryptoProviderType">Тип Критопровайдера</param> /// <param name="bytes"></param> /// <returns></returns> public static string ComputeHash(CryptoProviderTypeEnum cryptoProviderType, byte[] bytes) { byte[] hashValue; GostCryptoConfig.ProviderType = (int)cryptoProviderType; var hashAlgorithm = new Gost3411HashAlgorithm(); hashValue = hashAlgorithm.ComputeHash(bytes); return(BitConverter.ToString(hashValue).Replace("-", "")); }
/// <summary> /// Первичная инициализация /// </summary> /// <param name="certificateThumbPrint">отпечаток сертификата</param> /// <param name="privateKeyPassword">пароль от контейнера закрытого ключа</param> /// <param name="cryptoProviderType">тип крипто провайдера</param> public static void InitConfig(string certificateThumbPrint, string privateKeyPassword, int cryptoProviderType) { CertificateThumbPrint = certificateThumbPrint; PrivateKeyPassword = privateKeyPassword; CryptoProviderType = (CryptoProviderTypeEnum)cryptoProviderType; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; ServicePointManager.CheckCertificateRevocationList = false; ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true); ServicePointManager.Expect100Continue = false; }
public GostCryptoProvider(CryptoProviderTypeEnum cryptoProviderType) { GostCryptoConfig.ProviderType = (int)cryptoProviderType; }
public GostXadesBesService(CryptoProviderTypeEnum cryptoProviderType) { this.cryptoProviderType = cryptoProviderType; }