return mask;
}
- static internal string HashNameFromOid (string oid)
+ static internal string HashNameFromOid (string oid, bool throwOnError = true)
{
switch (oid) {
case "1.2.840.113549.1.1.2": // MD2 with RSA encryption
case "1.3.36.3.3.1.2":
return "RIPEMD160";
default:
- throw new CryptographicException ("Unsupported hash algorithm: " + oid);
+ if (throwOnError)
+ throw new CryptographicException ("Unsupported hash algorithm: " + oid);
+ return null;
}
}
if (certhash == null) {
if ((decoder == null) || (decoder.Count < 1))
return null;
+ string algo = PKCS1.HashNameFromOid (m_signaturealgo, false);
+ if (algo == null)
+ return null;
byte[] toBeSigned = decoder [0].GetBytes ();
- using (var hash = PKCS1.CreateFromOid (m_signaturealgo))
+ using (var hash = PKCS1.CreateFromName (algo))
certhash = hash.ComputeHash (toBeSigned, 0, toBeSigned.Length);
}
return (byte[]) certhash.Clone ();