/// <summary>Extracts secret information from the encrypted key exchange data.</summary> /// <returns>The secret information derived from the key exchange data.</returns> /// <param name="rgbData">The key exchange data within which the secret information is hidden. </param> /// <exception cref="T:System.Security.Cryptography.CryptographicException">The key exchange data verification has failed. </exception> /// <exception cref="T:System.Security.Cryptography.CryptographicUnexpectedOperationException">The key is missing.</exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> /// </PermissionSet> public override byte[] DecryptKeyExchange(byte[] rgbData) { if (this.rsa == null) { string text = Locale.GetText("No RSA key specified"); throw new CryptographicUnexpectedOperationException(text); } SHA1 hash = SHA1.Create(); byte[] array = PKCS1.Decrypt_OAEP(this.rsa, hash, rgbData); if (array != null) { return(array); } throw new CryptographicException(Locale.GetText("OAEP decoding error.")); }
public override byte[] DecryptKeyExchange(byte[] rgbData) { if (rsa == null) { string msg = Locale.GetText("No RSA key specified"); throw new CryptographicUnexpectedOperationException(msg); } SHA1 sha1 = SHA1.Create(); byte[] result = PKCS1.Decrypt_OAEP(rsa, sha1, rgbData); if (result != null) { return(result); } throw new CryptographicException(Locale.GetText("OAEP decoding error.")); }