private static int GetAlgorithmNid(HashAlgorithmName hashAlgorithmName)
{
// All of the current HashAlgorithmName values correspond to the SN values in OpenSSL 0.9.8.
// If there's ever a new one that doesn't, translate it here.
string sn = hashAlgorithmName.Name;
int nid = Interop.Crypto.ObjSn2Nid(sn);
if (nid == Interop.Crypto.NID_undef)
{
throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmName.Name);
}
return nid;
}