private static string GetHashAlgorithmOid(object hashAlg) { string hashAlgOid = null; if (hashAlg is string) { hashAlgOid = GostCryptoConfig.MapNameToOID((string)hashAlg); if (string.IsNullOrEmpty(hashAlgOid)) { hashAlgOid = (string)hashAlg; } } else if (hashAlg is HashAlgorithm) { hashAlgOid = GostCryptoConfig.MapNameToOID(hashAlg.GetType().ToString()); } else if (hashAlg is Type) { hashAlgOid = GostCryptoConfig.MapNameToOID(hashAlg.ToString()); } if (string.IsNullOrEmpty(hashAlgOid)) { throw ExceptionUtility.Argument("hashAlg", Resources.InvalidHashAlgorithm); } return(hashAlgOid); }
public override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) { AsymmetricSignatureDeformatter item = (AsymmetricSignatureDeformatter)GostCryptoConfig.CreateFromName(DeformatterAlgorithm); item.SetKey(key); item.SetHashAlgorithm("SHA1"); return(item); }