// GPG4Browsers - An OpenPGP implementation in javascript // Copyright (C) 2011 Recurity Labs GmbH // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /** * @protected * @class * @classdesc Top-level message object. Contains information from one or more packets */ function openpgp_msg_message() { // -1 = no valid passphrase submitted // -2 = no private key found // -3 = decryption error // text = valid decryption this.text = ""; this.messagePacket = null; this.type = null; /** * Decrypts a message and generates user interface message out of the found. * MDC will be verified as well as message signatures * @param {openpgp_msg_privatekey} private_key the private the message is encrypted with (corresponding to the session key) * @param {openpgp_packet_encryptedsessionkey} sessionkey the session key to be used to decrypt the message * @return {String} plaintext of the message or null on error */ function decrypt(private_key, sessionkey) { var textParts = this.decryptAndVerifySignature(private_key, sessionkey); if (textParts == null) { return null; } var texts = []; for (var i=0; i