public override byte[] DecryptEncryptedKey(EncryptedKey encryptedKey) { if (encryptedKey == null) { throw new ArgumentNullException(encryptedKey.GetType().Name); } if (encryptedKey.CipherData.CipherValue == null) { throw new NotImplementedException("Unable to decode CipherData of type \"CipherReference\"."); } // use the key info if (privateKey == null) { return(base.DecryptEncryptedKey(encryptedKey)); } var useOaep = (encryptedKey.EncryptionMethod != null && encryptedKey.EncryptionMethod.KeyAlgorithm == XmlEncRSAOAEPUrl); return(DecryptKey(encryptedKey.CipherData.CipherValue, privateKey, useOaep)); }