示例#1
0
        /// <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("-", ""));
        }
示例#2
0
 /// <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;
 }
示例#3
0
 public GostCryptoProvider(CryptoProviderTypeEnum cryptoProviderType)
 {
     GostCryptoConfig.ProviderType = (int)cryptoProviderType;
 }
示例#4
0
 public GostXadesBesService(CryptoProviderTypeEnum cryptoProviderType)
 {
     this.cryptoProviderType = cryptoProviderType;
 }