public byte[] HashAndSign(string hashAlg, byte[] data, int offset, int count)
{
if (hashAlg == null)
throw new ArgumentNullException ("hashAlg");
if (data == null)
throw new ArgumentNullException ("data");
#if !SILVERLIGHT
var hasher = CryptoConfig.CreateFromName (hashAlg) as HashAlgorithm;
#else
HashAlgorithm hasher = null;
switch (hashAlg) {
case "SHA1":
hasher = new SHA1Managed();
break;
case "SHA256":
hasher = new SHA256Managed();
break;
}
#endif
if (hasher == null)
throw new ArgumentException ("Hash algorithm not found", "hashAlg");
return this.rsaCrypto.SignData (data, offset, count, hashAlg);
}