Updates to documentation. Most all classes should now be jsdoc compliant.

This commit is contained in:
Sean Colyer 2012-09-11 21:54:42 -04:00
parent 01ddec6431
commit 7aa4a83474
46 changed files with 12415 additions and 1680 deletions

File diff suppressed because one or more lines are too long

737
doc/_openpgp_packet.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

392
doc/openpgp_config.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

362
doc/openpgp_type_keyid.html Normal file

File diff suppressed because one or more lines are too long

751
doc/openpgp_type_mpi.html Normal file

File diff suppressed because one or more lines are too long

499
doc/openpgp_type_s2k.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the One-Pass Signature Packets (Tag 4) * @class
* @classdesc Implementation of the One-Pass Signature Packets (Tag 4)
* *
* RFC4880 5.4: * RFC4880 5.4:
* The One-Pass Signature packet precedes the signed data and contains * The One-Pass Signature packet precedes the signed data and contains
@ -36,10 +37,10 @@ function openpgp_packet_onepasssignature() {
/** /**
* parsing function for a one-pass signature packet (tag 4). * parsing function for a one-pass signature packet (tag 4).
* @param input [string] payload of a tag 4 packet * @param {string} input payload of a tag 4 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.packetLength = len; this.packetLength = len;
@ -71,14 +72,14 @@ function openpgp_packet_onepasssignature() {
/** /**
* creates a string representation of a one-pass signature packet * creates a string representation of a one-pass signature packet
* @param type [integer] Signature types as described in RFC4880 Section 5.2.1. * @param {integer} type Signature types as described in RFC4880 Section 5.2.1.
* @param hashalgorithm [integer] the hash algorithm used within the signature * @param {integer} hashalgorithm the hash algorithm used within the signature
* @param privatekey [openpgp_msg_privatekey] the private key used to generate the signature * @param {openpgp_msg_privatekey} privatekey the private key used to generate the signature
* @param length [integer] length of data to be signed * @param {integer} length length of data to be signed
* @param nested [boolean] boolean showing whether the signature is nested. * @param {boolean} nested boolean showing whether the signature is nested.
* "true" indicates that the next packet is another One-Pass Signature packet * "true" indicates that the next packet is another One-Pass Signature packet
* that describes another signature to be applied to the same message data. * that describes another signature to be applied to the same message data.
* @return [String] a string representation of a one-pass signature packet * @return {String} a string representation of a one-pass signature packet
*/ */
function write_packet(type, hashalgorithm, privatekey,length, nested) { function write_packet(type, hashalgorithm, privatekey,length, nested) {
var result =""; var result ="";
@ -99,7 +100,7 @@ function openpgp_packet_onepasssignature() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the one-pass signature packet * @return {string} String which gives some information about the one-pass signature packet
*/ */
function toString() { function toString() {
return '5.4. One-Pass Signature Packets (Tag 4)\n'+ return '5.4. One-Pass Signature Packets (Tag 4)\n'+
@ -115,7 +116,8 @@ function openpgp_packet_onepasssignature() {
this.read_packet = read_packet; this.read_packet = read_packet;
this.toString = toString; this.toString = toString;
this.write_packet = write_packet; this.write_packet = write_packet;
};// GPG4Browsers - An OpenPGP implementation in javascript };
// GPG4Browsers - An OpenPGP implementation in javascript
// Copyright (C) 2011 Recurity Labs GmbH // Copyright (C) 2011 Recurity Labs GmbH
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
@ -133,7 +135,8 @@ function openpgp_packet_onepasssignature() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the strange "Marker packet" (Tag 10) * @class
* @classdesc Implementation of the strange "Marker packet" (Tag 10)
* *
* RFC4880 5.8: An experimental version of PGP used this packet as the Literal * RFC4880 5.8: An experimental version of PGP used this packet as the Literal
* packet, but no released version of PGP generated Literal packets with this * packet, but no released version of PGP generated Literal packets with this
@ -147,14 +150,13 @@ function openpgp_packet_marker() {
/** /**
* parsing function for a literal data packet (tag 10). * parsing function for a literal data packet (tag 10).
* *
* @param input * @param {string} input payload of a tag 10 packet
* [string] payload of a tag 10 packet * @param {integer} position
* @param position * position to start reading from the input string
* [integer] position to start reading from the input string * @param {integer} len
* @param len * length of the packet or the remaining length of
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.packetLength = 3; this.packetLength = 3;
@ -169,7 +171,7 @@ function openpgp_packet_marker() {
/** /**
* Generates Debug output * Generates Debug output
* *
* @return String which gives some information about the keymaterial * @return {string} String which gives some information about the keymaterial
*/ */
function toString() { function toString() {
return "5.8. Marker Packet (Obsolete Literal Packet) (Tag 10)\n" return "5.8. Marker Packet (Obsolete Literal Packet) (Tag 10)\n"
@ -178,7 +180,8 @@ function openpgp_packet_marker() {
this.read_packet = read_packet; this.read_packet = read_packet;
this.toString = toString; this.toString = toString;
}// GPG4Browsers - An OpenPGP implementation in javascript }
// GPG4Browsers - An OpenPGP implementation in javascript
// Copyright (C) 2011 Recurity Labs GmbH // Copyright (C) 2011 Recurity Labs GmbH
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
@ -196,7 +199,8 @@ function openpgp_packet_marker() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Signature Packet (Tag 2) * @class
* @classdesc Implementation of the Signature Packet (Tag 2)
* *
* RFC4480 5.2: * RFC4480 5.2:
* A Signature packet describes a binding between some public key and * A Signature packet describes a binding between some public key and
@ -248,10 +252,10 @@ function openpgp_packet_signature() {
/** /**
* parsing function for a signature packet (tag 2). * parsing function for a signature packet (tag 2).
* @param input [string] payload of a tag 2 packet * @param {string} input payload of a tag 2 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.data = input.substring (position, position+len); this.data = input.substring (position, position+len);
@ -388,10 +392,10 @@ function openpgp_packet_signature() {
/** /**
* creates a string representation of a message signature packet (tag 2). * creates a string representation of a message signature packet (tag 2).
* This can be only used on text data * This can be only used on text data
* @param signature_type [integer] should be 1 (one) * @param {integer} signature_type should be 1 (one)
* @param data [String] data to be signed * @param {String} data data to be signed
* @param privatekey [openpgp_msg_privatekey] private key used to sign the message. (secMPIs MUST be unlocked) * @param {openpgp_msg_privatekey} privatekey private key used to sign the message. (secMPIs MUST be unlocked)
* @return string representation of a signature packet * @return {string} string representation of a signature packet
*/ */
function write_message_signature(signature_type, data, privatekey) { function write_message_signature(signature_type, data, privatekey) {
var publickey = privatekey.privateKeyPacket.publicKey; var publickey = privatekey.privateKeyPacket.publicKey;
@ -434,9 +438,9 @@ function openpgp_packet_signature() {
} }
/** /**
* creates a string representation of a sub signature packet (See RFC 4880 5.2.3.1) * creates a string representation of a sub signature packet (See RFC 4880 5.2.3.1)
* @param type [integer] subpacket signature type. Signature types as described in RFC4880 Section 5.2.3.2 * @param {integer} type subpacket signature type. Signature types as described in RFC4880 Section 5.2.3.2
* @param data [String] data to be included * @param {String} data data to be included
* @return [String] a string-representation of a sub signature packet (See RFC 4880 5.2.3.1) * @return {String} a string-representation of a sub signature packet (See RFC 4880 5.2.3.1)
*/ */
function write_sub_signature_packet(type, data) { function write_sub_signature_packet(type, data) {
var result = ""; var result = "";
@ -842,7 +846,7 @@ function openpgp_packet_signature() {
} }
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the signature packet * @return {string} String which gives some information about the signature packet
*/ */
function toString () { function toString () {
@ -901,7 +905,7 @@ function openpgp_packet_signature() {
/** /**
* gets the issuer key id of this signature * gets the issuer key id of this signature
* @return [String] issuer key id as string (8bytes) * @return {String} issuer key id as string (8bytes)
*/ */
function getIssuer() { function getIssuer() {
if (this.version == 4) if (this.version == 4)
@ -951,7 +955,8 @@ function openpgp_packet_signature() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Sym. Encrypted Integrity Protected Data Packet (Tag 18) * @class
* @classdesc Implementation of the Sym. Encrypted Integrity Protected Data Packet (Tag 18)
* *
* RFC4880 5.13: The Symmetrically Encrypted Integrity Protected Data packet is * RFC4880 5.13: The Symmetrically Encrypted Integrity Protected Data packet is
* a variant of the Symmetrically Encrypted Data packet. It is a new feature * a variant of the Symmetrically Encrypted Data packet. It is a new feature
@ -970,14 +975,12 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
/** /**
* parsing function for the packet. * parsing function for the packet.
* *
* @param input * @param {string} input payload of a tag 18 packet
* [string] payload of a tag 18 packet * @param {integer} position
* @param position * position to start reading from the input string
* [integer] position to start reading from the input string * @param {integer} len length of the packet or the remaining length of
* @param len
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encryptedintegrityprotecteddata] object * @return {openpgp_packet_encryptedintegrityprotecteddata} object
* representation * representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
@ -1008,11 +1011,9 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
* Creates a string representation of a Sym. Encrypted Integrity Protected * Creates a string representation of a Sym. Encrypted Integrity Protected
* Data Packet (tag 18) (see RFC4880 5.13) * Data Packet (tag 18) (see RFC4880 5.13)
* *
* @param symmetric_algorithm * @param {integer} symmetric_algorithm
* [integer] the selected symmetric encryption algorithm to be * the selected symmetric encryption algorithm to be used
* used * @param {String} key the key of cipher blocksize length to be used
* @param key
* [String] the key of cipher blocksize length to be used
* @param data * @param data
* plaintext data to be encrypted within the packet * plaintext data to be encrypted within the packet
* @return a string representation of the packet * @return a string representation of the packet
@ -1045,11 +1046,9 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
* Decrypts the encrypted data contained in this object read_packet must * Decrypts the encrypted data contained in this object read_packet must
* have been called before * have been called before
* *
* @param symmetric_algorithm_type * @param {integer} symmetric_algorithm_type
* [integer] the selected symmetric encryption algorithm to be * the selected symmetric encryption algorithm to be used
* used * @param {String} key the key of cipher blocksize length to be used
* @param key
* [String] the key of cipher blocksize length to be used
* @return the decrypted data of this packet * @return the decrypted data of this packet
*/ */
function decrypt(symmetric_algorithm_type, key) { function decrypt(symmetric_algorithm_type, key) {
@ -1110,7 +1109,8 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Modification Detection Code Packet (Tag 19) * @class
* @classdesc Implementation of the Modification Detection Code Packet (Tag 19)
* *
* RFC4880 5.14: The Modification Detection Code packet contains a SHA-1 hash of * RFC4880 5.14: The Modification Detection Code packet contains a SHA-1 hash of
* plaintext data, which is used to detect message modification. It is only used * plaintext data, which is used to detect message modification. It is only used
@ -1126,14 +1126,13 @@ function openpgp_packet_modificationdetectioncode() {
/** /**
* parsing function for a modification detection code packet (tag 19). * parsing function for a modification detection code packet (tag 19).
* *
* @param input * @param {String} input payload of a tag 19 packet
* [String] payload of a tag 19 packet * @param {Integer} position
* @param position * position to start reading from the input string
* [Integer] position to start reading from the input string * @param {Integer} len
* @param len * length of the packet or the remaining length of
* [Integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.packetLength = len; this.packetLength = len;
@ -1161,7 +1160,7 @@ function openpgp_packet_modificationdetectioncode() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* *
* @return String which gives some information about the modification * @return {string} String which gives some information about the modification
* detection code * detection code
*/ */
function toString() { function toString() {
@ -1189,6 +1188,8 @@ function openpgp_packet_modificationdetectioncode() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* @class
* @classdesc Implementation of the User ID Packet (Tag 13)
* A User ID packet consists of UTF-8 text that is intended to represent * A User ID packet consists of UTF-8 text that is intended to represent
* the name and email address of the key holder. By convention, it * the name and email address of the key holder. By convention, it
* includes an RFC 2822 [RFC2822] mail name-addr, but there are no * includes an RFC 2822 [RFC2822] mail name-addr, but there are no
@ -1205,10 +1206,10 @@ function openpgp_packet_userid() {
/** /**
* parsing function for a user id packet (tag 13). * parsing function for a user id packet (tag 13).
* @param input [string] payload of a tag 13 packet * @param {string} input payload of a tag 13 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.text = ''; this.text = '';
@ -1222,8 +1223,8 @@ function openpgp_packet_userid() {
/** /**
* creates a string representation of the user id packet * creates a string representation of the user id packet
* @param user_id [String] the user id as string ("John Doe <john.doe@mail.us") * @param {String} user_id the user id as string ("John Doe <john.doe@mail.us")
* @return [String] string representation * @return {String} string representation
*/ */
function write_packet(user_id) { function write_packet(user_id) {
this.text = user_id; this.text = user_id;
@ -1234,11 +1235,11 @@ function openpgp_packet_userid() {
/** /**
* Continue parsing packets belonging to the userid packet such as signatures * Continue parsing packets belonging to the userid packet such as signatures
* @param parent_node [openpgp_*] the parent object * @param {openpgp_*} parent_node the parent object
* @param input [String] input string to read the packet(s) from * @param {String} input input string to read the packet(s) from
* @param position [integer] start position for the parser * @param {integer} position start position for the parser
* @param len [integer] length of the packet(s) or remaining length of input * @param {integer} len length of the packet(s) or remaining length of input
* @return [integer] length of nodes read * @return {integer} length of nodes read
*/ */
function read_nodes(parent_node, input, position, len) { function read_nodes(parent_node, input, position, len) {
if (parent_node.tagType == 6) { // public key if (parent_node.tagType == 6) { // public key
@ -1318,7 +1319,7 @@ function openpgp_packet_userid() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the user id packet * @return {string} String which gives some information about the user id packet
*/ */
function toString() { function toString() {
var result = ' 5.11. User ID Packet (Tag 13)\n' + ' text (' var result = ' 5.11. User ID Packet (Tag 13)\n' + ' text ('
@ -1337,7 +1338,7 @@ function openpgp_packet_userid() {
/** /**
* lookup function to find certification revocation signatures * lookup function to find certification revocation signatures
* @param keyId string containing the key id of the issuer of this signature * @param {string} keyId string containing the key id of the issuer of this signature
* @return a CertificationRevocationSignature if found; otherwise null * @return a CertificationRevocationSignature if found; otherwise null
*/ */
function hasCertificationRevocationSignature(keyId) { function hasCertificationRevocationSignature(keyId) {
@ -1523,7 +1524,8 @@ function openpgp_packet_userid() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Public-Key Encrypted Session Key Packets (Tag 1) * @class
* @classdesc Public-Key Encrypted Session Key Packets (Tag 1)
* *
* RFC4880 5.1: A Public-Key Encrypted Session Key packet holds the session key * RFC4880 5.1: A Public-Key Encrypted Session Key packet holds the session key
* used to encrypt a message. Zero or more Public-Key Encrypted Session Key * used to encrypt a message. Zero or more Public-Key Encrypted Session Key
@ -1542,14 +1544,11 @@ function openpgp_packet_encryptedsessionkey() {
/** /**
* parsing function for a publickey encrypted session key packet (tag 1). * parsing function for a publickey encrypted session key packet (tag 1).
* *
* @param input * @param {string} input payload of a tag 1 packet
* [string] payload of a tag 1 packet * @param {integer} position position to start reading from the input string
* @param position * @param {integer} len length of the packet or the remaining length of
* [integer] position to start reading from the input string
* @param len
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_pub_key_packet(input, position, len) { function read_pub_key_packet(input, position, len) {
this.tagType = 1; this.tagType = 1;
@ -1594,23 +1593,19 @@ function openpgp_packet_encryptedsessionkey() {
/** /**
* create a string representation of a tag 1 packet * create a string representation of a tag 1 packet
* *
* @param publicKeyId * @param {String} publicKeyId
* [String] the public key id corresponding to publicMPIs key as * the public key id corresponding to publicMPIs key as string
* string * @param {Array[openpgp_type_mpi]} publicMPIs
* @param publicMPIs * multiprecision integer objects describing the public key
* [Array[openpgp_type_mpi]] multiprecision integer objects * @param {integer} pubalgo
* describing the public key * the corresponding public key algorithm // See RFC4880 9.1
* @param pubalgo * @param {integer} symmalgo
* [integer] the corresponding public key algorithm // See * the symmetric cipher algorithm used to encrypt the data within
* RFC4880 9.1 * an encrypteddatapacket or encryptedintegrityprotecteddatapacket
* @param symmalgo * following this packet //See RFC4880 9.2
* [integer] the symmetric cipher algorithm used to encrypt the * @param {String} sessionkey
* data within an encrypteddatapacket or * a string of randombytes representing the session key
* encryptedintegrityprotecteddatapacket following this packet // * @return {String} the string representation
* See RFC4880 9.2
* @param sessionkey
* [String] a string of randombytes representing the session key
* @return [String] the string representation
*/ */
function write_pub_key_packet(publicKeyId, publicMPIs, pubalgo, symmalgo, function write_pub_key_packet(publicKeyId, publicMPIs, pubalgo, symmalgo,
sessionkey) { sessionkey) {
@ -1636,14 +1631,12 @@ function openpgp_packet_encryptedsessionkey() {
/** /**
* parsing function for a symmetric encrypted session key packet (tag 3). * parsing function for a symmetric encrypted session key packet (tag 3).
* *
* @param input * @param {string} input payload of a tag 1 packet
* [string] payload of a tag 1 packet * @param {integer} position position to start reading from the input string
* @param position * @param {integer} len
* [integer] position to start reading from the input string * length of the packet or the remaining length of
* @param len
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_symmetric_key_packet(input, position, len) { function read_symmetric_key_packet(input, position, len) {
this.tagType = 3; this.tagType = 3;
@ -1671,12 +1664,11 @@ function openpgp_packet_encryptedsessionkey() {
* Decrypts the session key (only for public key encrypted session key * Decrypts the session key (only for public key encrypted session key
* packets (tag 1) * packets (tag 1)
* *
* @param msg * @param {openpgp_msg_message} msg
* [openpgp_msg_message] the message object (with member * the message object (with member encryptedData
* encryptedData * @param {openpgp_msg_privatekey} key
* @param key * private key with secMPIs unlocked
* [openpgp_msg_privatekey] private key with secMPIs unlocked * @return {String} the unencrypted session key
* @return [String] the unencrypted session key
*/ */
function decrypt(msg, key) { function decrypt(msg, key) {
if (this.tagType == 1) { if (this.tagType == 1) {
@ -1757,7 +1749,8 @@ function openpgp_packet_encryptedsessionkey() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Literal Data Packet (Tag 11) * @class
* @classdesc Implementation of the Literal Data Packet (Tag 11)
* *
* RFC4880 5.9: A Literal Data packet contains the body of a message; data that * RFC4880 5.9: A Literal Data packet contains the body of a message; data that
* is not to be further interpreted. * is not to be further interpreted.
@ -1768,14 +1761,13 @@ function openpgp_packet_literaldata() {
/** /**
* parsing function for a literal data packet (tag 11). * parsing function for a literal data packet (tag 11).
* *
* @param input * @param {string} input payload of a tag 11 packet
* [string] payload of a tag 11 packet * @param {integer} position
* @param position * position to start reading from the input string
* [integer] position to start reading from the input string * @param {integer} len
* @param len * length of the packet or the remaining length of
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.packetLength = len; this.packetLength = len;
@ -1794,9 +1786,8 @@ function openpgp_packet_literaldata() {
/** /**
* Creates a string representation of the packet * Creates a string representation of the packet
* *
* @param data * @param {String} data the data to be inserted as body
* [String] the data to be inserted as body * @return {String} string-representation of the packet
* @return [String] string-representation of the packet
*/ */
function write_packet(data) { function write_packet(data) {
data = data.replace(/\r\n/g, "\n").replace(/\n/g, "\r\n"); data = data.replace(/\r\n/g, "\n").replace(/\n/g, "\r\n");
@ -1824,7 +1815,7 @@ function openpgp_packet_literaldata() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* *
* @return String which gives some information about the keymaterial * @return {string} String which gives some information about the keymaterial
*/ */
function toString() { function toString() {
return '5.9. Literal Data Packet (Tag 11)\n' + ' length: ' return '5.9. Literal Data Packet (Tag 11)\n' + ' length: '
@ -1856,7 +1847,8 @@ function openpgp_packet_literaldata() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Symmetrically Encrypted Data Packet (Tag 9) * @class
* @classdesc Implementation of the Symmetrically Encrypted Data Packet (Tag 9)
* *
* RFC4880 5.7: The Symmetrically Encrypted Data packet contains data encrypted * RFC4880 5.7: The Symmetrically Encrypted Data packet contains data encrypted
* with a symmetric-key algorithm. When it has been decrypted, it contains other * with a symmetric-key algorithm. When it has been decrypted, it contains other
@ -1874,14 +1866,11 @@ function openpgp_packet_encrypteddata() {
/** /**
* parsing function for the packet. * parsing function for the packet.
* *
* @param input * @param {string} input payload of a tag 9 packet
* [string] payload of a tag 9 packet * @param {integer} position position to start reading from the input string
* @param position * @param {integer} len length of the packet or the remaining length of
* [integer] position to start reading from the input string
* @param len
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
var mypos = position; var mypos = position;
@ -1895,10 +1884,10 @@ function openpgp_packet_encrypteddata() {
/** /**
* symmetrically decrypt the packet data * symmetrically decrypt the packet data
* *
* @param symmetric_algorithm_type * @param {integer} symmetric_algorithm_type
* [integer] symmetric key algorithm to use // See RFC4880 9.2 * symmetric key algorithm to use // See RFC4880 9.2
* @param key * @param {String} key
* [String] key as string with the corresponding length to the * key as string with the corresponding length to the
* algorithm * algorithm
* @return the decrypted data; * @return the decrypted data;
*/ */
@ -1913,14 +1902,11 @@ function openpgp_packet_encrypteddata() {
/** /**
* Creates a string representation of the packet * Creates a string representation of the packet
* *
* @param algo * @param {Integer} algo symmetric key algorithm to use // See RFC4880 9.2
* [Integer] symmetric key algorithm to use // See RFC4880 9.2 * @param {String} key key as string with the corresponding length to the
* @param key
* [String] key as string with the corresponding length to the
* algorithm * algorithm
* @param data * @param {String} data data to be
* [String] data to be * @return {String} string-representation of the packet
* @return [String] string-representation of the packet
*/ */
function write_packet(algo, key, data) { function write_packet(algo, key, data) {
var result = ""; var result = "";
@ -1960,6 +1946,8 @@ function openpgp_packet_encrypteddata() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* @class
* @classdesc Implementation of the User Attribute Packet (Tag 17)
* The User Attribute packet is a variation of the User ID packet. It * The User Attribute packet is a variation of the User ID packet. It
* is capable of storing more types of data than the User ID packet, * is capable of storing more types of data than the User ID packet,
* which is limited to text. Like the User ID packet, a User Attribute * which is limited to text. Like the User ID packet, a User Attribute
@ -1983,10 +1971,10 @@ function openpgp_packet_userattribute() {
/** /**
* parsing function for a user attribute packet (tag 17). * parsing function for a user attribute packet (tag 17).
* @param input [string] payload of a tag 17 packet * @param {string} input payload of a tag 17 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet (input, position, len) { function read_packet (input, position, len) {
var total_len = 0; var total_len = 0;
@ -2031,7 +2019,7 @@ function openpgp_packet_userattribute() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the user attribute packet * @return {string} String which gives some information about the user attribute packet
*/ */
function toString() { function toString() {
var result = '5.12. User Attribute Packet (Tag 17)\n'+ var result = '5.12. User Attribute Packet (Tag 17)\n'+
@ -2044,11 +2032,11 @@ function openpgp_packet_userattribute() {
/** /**
* Continue parsing packets belonging to the user attribute packet such as signatures * Continue parsing packets belonging to the user attribute packet such as signatures
* @param parent_node [openpgp_*] the parent object * @param {openpgp_*} parent_node the parent object
* @param input [String] input string to read the packet(s) from * @param {String} input input string to read the packet(s) from
* @param position [integer] start position for the parser * @param {integer} position start position for the parser
* @param len [integer] length of the packet(s) or remaining length of input * @param {integer} len length of the packet(s) or remaining length of input
* @return [integer] length of nodes read * @return {integer} length of nodes read
*/ */
function read_nodes(parent_node, input, position, len) { function read_nodes(parent_node, input, position, len) {
@ -2094,7 +2082,8 @@ function openpgp_packet_userattribute() {
this.read_nodes = read_nodes; this.read_nodes = read_nodes;
this.toString = toString; this.toString = toString;
};// GPG4Browsers - An OpenPGP implementation in javascript };
// GPG4Browsers - An OpenPGP implementation in javascript
// Copyright (C) 2011 Recurity Labs GmbH // Copyright (C) 2011 Recurity Labs GmbH
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
@ -2111,14 +2100,18 @@ function openpgp_packet_userattribute() {
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/**
* @class
* @classdesc Parent openpgp packet class. Operations focus on determining packet types
* and packet header.
*/
function _openpgp_packet() { function _openpgp_packet() {
/** /**
* Encodes a given integer of length to the openpgp length specifier to a * Encodes a given integer of length to the openpgp length specifier to a
* string * string
* *
* @param length * @param {Integer} length of the length to encode
* [Integer] of the length to encode * @return {string} string with openpgp length representation
* @return string with openpgp length representation
*/ */
function encode_length(length) { function encode_length(length) {
result = ""; result = "";
@ -2146,11 +2139,9 @@ function _openpgp_packet() {
* Writes a packet header version 4 with the given tag_type and length to a * Writes a packet header version 4 with the given tag_type and length to a
* string * string
* *
* @param tag_type * @param {integer} tag_type tag type
* integer of tag type * @param {integer} length length of the payload
* @param length * @return {string} string of the header
* integer length of the payload
* @return string of the header
*/ */
function write_packet_header(tag_type, length) { function write_packet_header(tag_type, length) {
/* we're only generating v4 packet headers here */ /* we're only generating v4 packet headers here */
@ -2164,11 +2155,9 @@ function _openpgp_packet() {
* Writes a packet header Version 3 with the given tag_type and length to a * Writes a packet header Version 3 with the given tag_type and length to a
* string * string
* *
* @param tag_type * @param {integer} tag_type tag type
* integer of tag type * @param {integer} length length of the payload
* @param length * @return {string} string of the header
* integer length of the payload
* @return string of the header
*/ */
function write_old_packet_header(tag_type, length) { function write_old_packet_header(tag_type, length) {
var result = ""; var result = "";
@ -2193,13 +2182,10 @@ function _openpgp_packet() {
/** /**
* Generic static Packet Parser function * Generic static Packet Parser function
* *
* @param input * @param {String} input input stream as string
* [String] input stream as string * @param {integer} position position to start parsing
* @param position * @param {integer} len length of the input from position on
* [integer] position to start parsing * @return {openpgp_packet_*} returns a parsed openpgp_packet
* @param len
* [integer] length of the input from position on
* @return [openpgp_packet_*] returns a parsed openpgp_packet
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
// some sanity checks // some sanity checks
@ -2521,7 +2507,8 @@ var openpgp_packet = new _openpgp_packet();
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Compressed Data Packet (Tag 8) * @class
* @classdesc Implementation of the Compressed Data Packet (Tag 8)
* *
* RFC4880 5.6: * RFC4880 5.6:
* The Compressed Data packet contains compressed data. Typically, this * The Compressed Data packet contains compressed data. Typically, this
@ -2534,10 +2521,10 @@ function openpgp_packet_compressed() {
/** /**
* parsing function for the packet. * parsing function for the packet.
* @param input [string] payload of a tag 8 packet * @param {string} input payload of a tag 8 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_compressed] object representation * @return {openpgp_packet_compressed} object representation
*/ */
function read_packet (input, position, len) { function read_packet (input, position, len) {
this.packetLength = len; this.packetLength = len;
@ -2551,7 +2538,7 @@ function openpgp_packet_compressed() {
/** /**
* decompression method for decompressing the compressed data * decompression method for decompressing the compressed data
* read by read_packet * read by read_packet
* @return [String] the decompressed data * @return {String} the decompressed data
*/ */
function decompress() { function decompress() {
if (this.decompressedData != null) if (this.decompressedData != null)
@ -2605,9 +2592,9 @@ function openpgp_packet_compressed() {
/** /**
* Compress the packet data (member decompressedData) * Compress the packet data (member decompressedData)
* @param type [integer] algorithm to be used // See RFC 4880 9.3 * @param {integer} type algorithm to be used // See RFC 4880 9.3
* @param data [String] data to be compressed * @param {String} data data to be compressed
* @return [String] The compressed data stored in attribute compressedData * @return {String} The compressed data stored in attribute compressedData
*/ */
function compress(type, data) { function compress(type, data) {
this.type = type; this.type = type;
@ -2637,9 +2624,9 @@ function openpgp_packet_compressed() {
/** /**
* creates a string representation of the packet * creates a string representation of the packet
* @param algorithm [integer] algorithm to be used // See RFC 4880 9.3 * @param {integer} algorithm algorithm to be used // See RFC 4880 9.3
* @param data [String] data to be compressed * @param {String} data data to be compressed
* @return [String] string-representation of the packet * @return {String} string-representation of the packet
*/ */
function write_packet(algorithm, data) { function write_packet(algorithm, data) {
this.decompressedData = data; this.decompressedData = data;
@ -2652,7 +2639,7 @@ function openpgp_packet_compressed() {
/** /**
* pretty printing the packet (useful for debug purposes) * pretty printing the packet (useful for debug purposes)
* @return [String] * @return {String}
*/ */
function toString() { function toString() {
return '5.6. Compressed Data Packet (Tag 8)\n'+ return '5.6. Compressed Data Packet (Tag 8)\n'+
@ -2685,7 +2672,8 @@ function openpgp_packet_compressed() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Key Material Packet (Tag 5,6,7,14) * @class
* @classdesc Implementation of the Key Material Packet (Tag 5,6,7,14)
* *
* RFC4480 5.5: * RFC4480 5.5:
* A key material packet contains all the information about a public or * A key material packet contains all the information about a public or
@ -3214,11 +3202,11 @@ function openpgp_packet_keymaterial() {
/** /**
* Continue parsing packets belonging to the key material such as signatures * Continue parsing packets belonging to the key material such as signatures
* @param parent_node [openpgp_*] the parent object * @param {openpgp_*} parent_node the parent object
* @param input [String] input string to read the packet(s) from * @param {String} input input string to read the packet(s) from
* @param position [integer] start position for the parser * @param {integer} position start position for the parser
* @param len [integer] length of the packet(s) or remaining length of input * @param {integer} len length of the packet(s) or remaining length of input
* @return [integer] length of nodes read * @return {integer} length of nodes read
*/ */
function read_nodes(parent_node, input, position, len) { function read_nodes(parent_node, input, position, len) {
this.parentNode = parent_node; this.parentNode = parent_node;
@ -3326,7 +3314,7 @@ function openpgp_packet_keymaterial() {
/** /**
* calculates the key id of they key * calculates the key id of they key
* @return [String] a 8 byte key id * @return {String} a 8 byte key id
*/ */
function getKeyId() { function getKeyId() {
if (this.version == 4) { if (this.version == 4) {
@ -3341,7 +3329,7 @@ function openpgp_packet_keymaterial() {
/** /**
* calculates the fingerprint of the key * calculates the fingerprint of the key
* @return [String] a string containing the fingerprint * @return {String} a string containing the fingerprint
*/ */
function getFingerprint() { function getFingerprint() {
if (this.version == 4) { if (this.version == 4) {
@ -3356,8 +3344,12 @@ function openpgp_packet_keymaterial() {
/* /*
* creates an OpenPGP key packet for the given key. much TODO in regards to s2k, subkeys. * creates an OpenPGP key packet for the given key. much TODO in regards to s2k, subkeys.
* @param keyType [int] follows the OpenPGP algorithm standard, IE 1 corresponds to RSA. * @param {int} keyType follows the OpenPGP algorithm standard, IE 1 corresponds to RSA.
* @param key [RSA.keyObject] * @param {RSA.keyObject} key
* @param password
* @param s2kHash
* @param symmetricEncryptionAlgorithm
* @param timePacket
* @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body} * @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body}
*/ */
function write_private_key(keyType, key, password, s2kHash, symmetricEncryptionAlgorithm, timePacket){ function write_private_key(keyType, key, password, s2kHash, symmetricEncryptionAlgorithm, timePacket){
@ -3433,8 +3425,9 @@ function openpgp_packet_keymaterial() {
/* /*
* same as write_private_key, but has less information because of public key. * same as write_private_key, but has less information because of public key.
* @param keyType [int] follows the OpenPGP algorithm standard, IE 1 corresponds to RSA. * @param {int} keyType follows the OpenPGP algorithm standard, IE 1 corresponds to RSA.
* @param key [RSA.keyObject] * @param {RSA.keyObject} key
* @param timePacket
* @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body} * @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body}
*/ */
function write_public_key(keyType, key, timePacket){ function write_public_key(keyType, key, timePacket){
@ -9569,6 +9562,12 @@ function openpgp_crypto_generateKeyPair(keyType, numBits, passphrase, s2kHash, s
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/**
* @fileoverview The openpgp base class should provide all of the functionality
* to consume the openpgp.js library. All additional classes are documented
* for extending and developing on top of the base library.
*/
/** /**
* GPG4Browsers Core interface. A single instance is hold * GPG4Browsers Core interface. A single instance is hold
* from the beginning. To use this library call "openpgp.init()" * from the beginning. To use this library call "openpgp.init()"
@ -10237,7 +10236,6 @@ function openpgp_msg_publickey() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the GPG4Browsers config object
* *
* This object contains configuration values and implements * This object contains configuration values and implements
* storing and retrieving configuration them from HTML5 local storage. * storing and retrieving configuration them from HTML5 local storage.
@ -10246,6 +10244,8 @@ function openpgp_msg_publickey() {
* using openpgp.config * using openpgp.config
* Stored config parameters can be accessed using * Stored config parameters can be accessed using
* openpgp.config.config * openpgp.config.config
* @class
* @classdesc Implementation of the GPG4Browsers config object
*/ */
function openpgp_config() { function openpgp_config() {
this.config = null; this.config = null;
@ -10265,7 +10265,7 @@ function openpgp_config() {
keyserver: "keyserver.linux.it" // "pgp.mit.edu:11371" keyserver: "keyserver.linux.it" // "pgp.mit.edu:11371"
}; };
this.versionstring ="OpenPGP.js v.1.20120905"; this.versionstring ="OpenPGP.js v.1.20120911";
this.commentstring ="http://openpgpjs.org"; this.commentstring ="http://openpgpjs.org";
/** /**
* reads the config out of the HTML5 local storage * reads the config out of the HTML5 local storage
@ -10971,12 +10971,9 @@ JXG.decompress = function(str) {return unescape((new JXG.Util.Unzip(JXG.Util.Bas
*/ */
/**
* @fileoverview Utilities for uncompressing and base64 decoding
*/
/** /**
* @class Util class * @class Util class
* @classdesc Utilities for uncompressing and base64 decoding
* Class for gunzipping, unzipping and base64 decoding of files. * Class for gunzipping, unzipping and base64 decoding of files.
* It is used for reading GEONExT, Geogebra and Intergeo files. * It is used for reading GEONExT, Geogebra and Intergeo files.
* *
@ -12360,13 +12357,14 @@ function openpgp_msg_message() {
// - MPI = c | d << 8 | e << ((MPI.length -2)*8) | f ((MPI.length -2)*8) // - MPI = c | d << 8 | e << ((MPI.length -2)*8) | f ((MPI.length -2)*8)
/** /**
* Implementation of type MPI (RFC4880 3.2) * @class
* Multiprecision integers (also called MPIs) are unsigned integers used * @classdescImplementation of type MPI (RFC4880 3.2)
* to hold large integers such as the ones used in cryptographic * Multiprecision integers (also called MPIs) are unsigned integers used
* calculations. * to hold large integers such as the ones used in cryptographic
* An MPI consists of two pieces: a two-octet scalar that is the length * calculations.
* of the MPI in bits followed by a string of octets that contain the * An MPI consists of two pieces: a two-octet scalar that is the length
* actual integer. * of the MPI in bits followed by a string of octets that contain the
* actual integer.
*/ */
function openpgp_type_mpi() { function openpgp_type_mpi() {
this.MPI = null; this.MPI = null;
@ -12375,10 +12373,10 @@ function openpgp_type_mpi() {
this.data = null; this.data = null;
/** /**
* parsing function for a mpi (RFC 4880 3.2). * parsing function for a mpi (RFC 4880 3.2).
* @param input [string] payload of mpi data * @param {string} input payload of mpi data
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_type_mpi] object representation * @return {openpgp_type_mpi} object representation
*/ */
function read(input, position, len) { function read(input, position, len) {
var mypos = position; var mypos = position;
@ -12407,7 +12405,7 @@ function openpgp_type_mpi() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the mpi * @return {string} String which gives some information about the mpi
*/ */
function toString() { function toString() {
var r = " MPI("+this.mpiBitLength+"b/"+this.mpiByteLength+"B) : 0x"; var r = " MPI("+this.mpiBitLength+"b/"+this.mpiByteLength+"B) : 0x";
@ -12417,7 +12415,7 @@ function openpgp_type_mpi() {
/** /**
* converts the mpi to an BigInteger object * converts the mpi to an BigInteger object
* @return [BigInteger] * @return {BigInteger}
*/ */
function getBigInteger() { function getBigInteger() {
return new BigInteger(util.hexstrdump(this.MPI),16); return new BigInteger(util.hexstrdump(this.MPI),16);
@ -12432,7 +12430,7 @@ function openpgp_type_mpi() {
/** /**
* gets the length of the mpi in bytes * gets the length of the mpi in bytes
* @return [integer] mpi byte length * @return {integer} mpi byte length
*/ */
function getByteLength() { function getByteLength() {
return this.mpiByteLength; return this.mpiByteLength;
@ -12440,8 +12438,8 @@ function openpgp_type_mpi() {
/** /**
* creates an mpi from the specified string * creates an mpi from the specified string
* @param data [String] data to read the mpi from * @param {String} data data to read the mpi from
* @return [openpgp_type_mpi] * @return {openpgp_type_mpi}
*/ */
function create(data) { function create(data) {
this.MPI = data; this.MPI = data;
@ -12452,7 +12450,7 @@ function openpgp_type_mpi() {
/** /**
* converts the mpi object to a string as specified in RFC4880 3.2 * converts the mpi object to a string as specified in RFC4880 3.2
* @return [String] mpi byte representation * @return {String} mpi byte representation
*/ */
function toBin() { function toBin() {
var result = String.fromCharCode((this.mpiBitLength >> 8) & 0xFF); var result = String.fromCharCode((this.mpiBitLength >> 8) & 0xFF);
@ -12487,7 +12485,8 @@ function openpgp_type_mpi() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of type key id (RFC4880 3.3) * @class
* @classdesc Implementation of type key id (RFC4880 3.3)
* A Key ID is an eight-octet scalar that identifies a key. * A Key ID is an eight-octet scalar that identifies a key.
Implementations SHOULD NOT assume that Key IDs are unique. The Implementations SHOULD NOT assume that Key IDs are unique. The
section "Enhanced Key Formats" below describes how Key IDs are section "Enhanced Key Formats" below describes how Key IDs are
@ -12496,8 +12495,8 @@ function openpgp_type_mpi() {
function openpgp_type_keyid() { function openpgp_type_keyid() {
/** /**
* parsing method for a key id * parsing method for a key id
* @param input [String] input to read the key id from * @param {String} input input to read the key id from
* @param position [integer] position where to start reading the key id from input * @param {integer} position position where to start reading the key id from input
* @return this object * @return this object
*/ */
function read_packet(input, position) { function read_packet(input, position) {
@ -12507,7 +12506,7 @@ function openpgp_type_keyid() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return [String] Key Id as hexadecimal string * @return {String} Key Id as hexadecimal string
*/ */
function toString() { function toString() {
return util.hexstrdump(this.bytes); return util.hexstrdump(this.bytes);
@ -12534,7 +12533,8 @@ function openpgp_type_keyid() {
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the String-to-key specifier (RFC4880 3.7) * @class
* @classdesc Implementation of the String-to-key specifier (RFC4880 3.7)
* String-to-key (S2K) specifiers are used to convert passphrase strings * String-to-key (S2K) specifiers are used to convert passphrase strings
into symmetric-key encryption/decryption keys. They are used in two into symmetric-key encryption/decryption keys. They are used in two
places, currently: to encrypt the secret part of private keys in the places, currently: to encrypt the secret part of private keys in the
@ -12544,9 +12544,9 @@ function openpgp_type_keyid() {
function openpgp_type_s2k() { function openpgp_type_s2k() {
/** /**
* parsing function for a string-to-key specifier (RFC 4880 3.7). * parsing function for a string-to-key specifier (RFC 4880 3.7).
* @param input [string] payload of string-to-key specifier * @param {string} input payload of string-to-key specifier
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @return [openpgp_type_s2k] object representation * @return {openpgp_type_s2k} object representation
*/ */
function read(input, position) { function read(input, position) {
var mypos = position; var mypos = position;
@ -12594,7 +12594,7 @@ function openpgp_type_s2k() {
/** /**
* writes an s2k hash based on the inputs. * writes an s2k hash based on the inputs.
* @return [String] produced key of hashAlgorithm hash length * @return {String} produced key of hashAlgorithm hash length
*/ */
function write(type, hash, passphrase, salt, c){ function write(type, hash, passphrase, salt, c){
this.type = type; this.type = type;
@ -12608,8 +12608,8 @@ function openpgp_type_s2k() {
/** /**
* produces a key using the specified passphrase and the defined hashAlgorithm * produces a key using the specified passphrase and the defined hashAlgorithm
* @param passphrase [String] passphrase containing user input * @param passphrase {String} passphrase containing user input
* @return [String] produced key with a length corresponding to hashAlgorithm hash length * @return {String} produced key with a length corresponding to hashAlgorithm hash length
*/ */
function produce_key(passphrase, numBytes) { function produce_key(passphrase, numBytes) {
if (this.type == 0) { if (this.type == 0) {

View File

@ -391,7 +391,7 @@ return this.len=b-c};this.write=function(){};this.toString=function(){for(var b=
this.subKeys.length;a++)b+=" "+this.subKeys[a].toString();return b};this.validate=function(){for(var b=0;b<this.revocationSignatures.length;b++)if(this.revocationSignatures[b].verify(this.publicKeyPacket.header+this.publicKeyPacket.data,this.publicKeyPacket))return!1;if(0!=this.subKeys.length){for(var a=!1,b=0;b<this.subKeys.length;b++)if(3==this.subKeys[b].verifyKey()){a=!0;break}if(!a)return!1}a=!1;for(b=0;b<this.userIds.length;b++)if(0==this.userIds[b].verify(this.publicKeyPacket)){a=!0;break}return!a? this.subKeys.length;a++)b+=" "+this.subKeys[a].toString();return b};this.validate=function(){for(var b=0;b<this.revocationSignatures.length;b++)if(this.revocationSignatures[b].verify(this.publicKeyPacket.header+this.publicKeyPacket.data,this.publicKeyPacket))return!1;if(0!=this.subKeys.length){for(var a=!1,b=0;b<this.subKeys.length;b++)if(3==this.subKeys[b].verifyKey()){a=!0;break}if(!a)return!1}a=!1;for(b=0;b<this.userIds.length;b++)if(0==this.userIds[b].verify(this.publicKeyPacket)){a=!0;break}return!a?
!1:!0};this.getFingerprint=function(){return this.publicKeyPacket.getFingerprint()};this.getKeyId=function(){return this.publicKeyPacket.getKeyId()};this.verifyBasicSignatures=function(){for(var b=0;b<this.revocationSignatures.length;)return this.revocationSignatures[b].verify(this.publicKeyPacket.header+this.publicKeyPacket.data,this.publicKeyPacket),!1;if(0!=this.subKeys.length){for(var a=!1,b=0;b<this.subKeys.length;b++)if(null!=this.subKeys[b]&&3==this.subKeys[b].verifyKey()){a=!0;break}if(!a)return!1}a= !1:!0};this.getFingerprint=function(){return this.publicKeyPacket.getFingerprint()};this.getKeyId=function(){return this.publicKeyPacket.getKeyId()};this.verifyBasicSignatures=function(){for(var b=0;b<this.revocationSignatures.length;)return this.revocationSignatures[b].verify(this.publicKeyPacket.header+this.publicKeyPacket.data,this.publicKeyPacket),!1;if(0!=this.subKeys.length){for(var a=!1,b=0;b<this.subKeys.length;b++)if(null!=this.subKeys[b]&&3==this.subKeys[b].verifyKey()){a=!0;break}if(!a)return!1}a=
this.getKeyId();for(b=0;b<this.userIds.length;b++)for(var c=0;c<this.userIds[b].certificationRevocationSignatures.length;c++)if(this.userIds[b].certificationSignatures[c].getIssuer==a&&4!=this.userIds[b].certificationSignatures[c].verifyBasic(this.publicKeyPacket))return!1;return!0}} this.getKeyId();for(b=0;b<this.userIds.length;b++)for(var c=0;c<this.userIds[b].certificationRevocationSignatures.length;c++)if(this.userIds[b].certificationSignatures[c].getIssuer==a&&4!=this.userIds[b].certificationSignatures[c].verifyBasic(this.publicKeyPacket))return!1;return!0}}
function openpgp_config(){this.config=null;this.default_config={prefer_hash_algorithm:2,encryption_cipher:9,compression:1,show_version:!0,show_comment:!0,integrity_protect:!0,composition_behavior:0,keyserver:"keyserver.linux.it"};this.versionstring="OpenPGP.js v.1.20120905";this.commentstring="http://openpgpjs.org";this.debug=!1;this.read=function(){var b=JSON.parse(window.localStorage.getItem("config"));null==b?(this.config=this.default_config,this.write()):this.config=b};this.write=function(){window.localStorage.setItem("config", function openpgp_config(){this.config=null;this.default_config={prefer_hash_algorithm:2,encryption_cipher:9,compression:1,show_version:!0,show_comment:!0,integrity_protect:!0,composition_behavior:0,keyserver:"keyserver.linux.it"};this.versionstring="OpenPGP.js v.1.20120911";this.commentstring="http://openpgpjs.org";this.debug=!1;this.read=function(){var b=JSON.parse(window.localStorage.getItem("config"));null==b?(this.config=this.default_config,this.write()):this.config=b};this.write=function(){window.localStorage.setItem("config",
JSON.stringify(this.config))}} JSON.stringify(this.config))}}
function openpgp_msg_privatekey(){this.subKeys=[];this.privateKeyPacket=null;this.userIds=[];this.userAttributes=[];this.revocationSignatures=[];this.subKeys=[];this.extractPublicKey=function(){for(var b=this.privateKeyPacket.publicKey.header+this.privateKeyPacket.publicKey.data,a=0;a<this.userIds.length;a++){if(0===this.userIds[a].certificationSignatures.length)return util.print_error("extractPublicKey - missing certification signatures"),null;for(var c=new openpgp_packet_userid,b=b+c.write_packet(this.userIds[a].text), function openpgp_msg_privatekey(){this.subKeys=[];this.privateKeyPacket=null;this.userIds=[];this.userAttributes=[];this.revocationSignatures=[];this.subKeys=[];this.extractPublicKey=function(){for(var b=this.privateKeyPacket.publicKey.header+this.privateKeyPacket.publicKey.data,a=0;a<this.userIds.length;a++){if(0===this.userIds[a].certificationSignatures.length)return util.print_error("extractPublicKey - missing certification signatures"),null;for(var c=new openpgp_packet_userid,b=b+c.write_packet(this.userIds[a].text),
c=0;c<this.userIds[a].certificationSignatures.length;c++)var d=this.userIds[a].certificationSignatures[c],b=b+(openpgp_packet.write_packet_header(2,d.data.length)+d.data)}for(a=0;a<this.subKeys.length;a++)if(c=this.subKeys[a].publicKey,b+=openpgp_packet.write_old_packet_header(14,c.data.length)+c.data,c=this.subKeys[a].subKeySignature,null!==c)b+=openpgp_packet.write_packet_header(2,c.data.length)+c.data;else return util.print_error("extractPublicKey - missing subkey signature"),null;return openpgp_encoding_armor(4, c=0;c<this.userIds[a].certificationSignatures.length;c++)var d=this.userIds[a].certificationSignatures[c],b=b+(openpgp_packet.write_packet_header(2,d.data.length)+d.data)}for(a=0;a<this.subKeys.length;a++)if(c=this.subKeys[a].publicKey,b+=openpgp_packet.write_old_packet_header(14,c.data.length)+c.data,c=this.subKeys[a].subKeySignature,null!==c)b+=openpgp_packet.write_packet_header(2,c.data.length)+c.data;else return util.print_error("extractPublicKey - missing subkey signature"),null;return openpgp_encoding_armor(4,

View File

@ -21,12 +21,9 @@ JXG.decompress = function(str) {return unescape((new JXG.Util.Unzip(JXG.Util.Bas
*/ */
/**
* @fileoverview Utilities for uncompressing and base64 decoding
*/
/** /**
* @class Util class * @class Util class
* @classdesc Utilities for uncompressing and base64 decoding
* Class for gunzipping, unzipping and base64 decoding of files. * Class for gunzipping, unzipping and base64 decoding of files.
* It is used for reading GEONExT, Geogebra and Intergeo files. * It is used for reading GEONExT, Geogebra and Intergeo files.
* *

View File

@ -16,7 +16,6 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the GPG4Browsers config object
* *
* This object contains configuration values and implements * This object contains configuration values and implements
* storing and retrieving configuration them from HTML5 local storage. * storing and retrieving configuration them from HTML5 local storage.
@ -25,6 +24,8 @@
* using openpgp.config * using openpgp.config
* Stored config parameters can be accessed using * Stored config parameters can be accessed using
* openpgp.config.config * openpgp.config.config
* @class
* @classdesc Implementation of the GPG4Browsers config object
*/ */
function openpgp_config() { function openpgp_config() {
this.config = null; this.config = null;

View File

@ -15,6 +15,12 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/**
* @fileoverview The openpgp base class should provide all of the functionality
* to consume the openpgp.js library. All additional classes are documented
* for extending and developing on top of the base library.
*/
/** /**
* GPG4Browsers Core interface. A single instance is hold * GPG4Browsers Core interface. A single instance is hold
* from the beginning. To use this library call "openpgp.init()" * from the beginning. To use this library call "openpgp.init()"

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Compressed Data Packet (Tag 8) * @class
* @classdesc Implementation of the Compressed Data Packet (Tag 8)
* *
* RFC4880 5.6: * RFC4880 5.6:
* The Compressed Data packet contains compressed data. Typically, this * The Compressed Data packet contains compressed data. Typically, this
@ -29,10 +30,10 @@ function openpgp_packet_compressed() {
/** /**
* parsing function for the packet. * parsing function for the packet.
* @param input [string] payload of a tag 8 packet * @param {string} input payload of a tag 8 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_compressed] object representation * @return {openpgp_packet_compressed} object representation
*/ */
function read_packet (input, position, len) { function read_packet (input, position, len) {
this.packetLength = len; this.packetLength = len;
@ -46,7 +47,7 @@ function openpgp_packet_compressed() {
/** /**
* decompression method for decompressing the compressed data * decompression method for decompressing the compressed data
* read by read_packet * read by read_packet
* @return [String] the decompressed data * @return {String} the decompressed data
*/ */
function decompress() { function decompress() {
if (this.decompressedData != null) if (this.decompressedData != null)
@ -100,9 +101,9 @@ function openpgp_packet_compressed() {
/** /**
* Compress the packet data (member decompressedData) * Compress the packet data (member decompressedData)
* @param type [integer] algorithm to be used // See RFC 4880 9.3 * @param {integer} type algorithm to be used // See RFC 4880 9.3
* @param data [String] data to be compressed * @param {String} data data to be compressed
* @return [String] The compressed data stored in attribute compressedData * @return {String} The compressed data stored in attribute compressedData
*/ */
function compress(type, data) { function compress(type, data) {
this.type = type; this.type = type;
@ -132,9 +133,9 @@ function openpgp_packet_compressed() {
/** /**
* creates a string representation of the packet * creates a string representation of the packet
* @param algorithm [integer] algorithm to be used // See RFC 4880 9.3 * @param {integer} algorithm algorithm to be used // See RFC 4880 9.3
* @param data [String] data to be compressed * @param {String} data data to be compressed
* @return [String] string-representation of the packet * @return {String} string-representation of the packet
*/ */
function write_packet(algorithm, data) { function write_packet(algorithm, data) {
this.decompressedData = data; this.decompressedData = data;
@ -147,7 +148,7 @@ function openpgp_packet_compressed() {
/** /**
* pretty printing the packet (useful for debug purposes) * pretty printing the packet (useful for debug purposes)
* @return [String] * @return {String}
*/ */
function toString() { function toString() {
return '5.6. Compressed Data Packet (Tag 8)\n'+ return '5.6. Compressed Data Packet (Tag 8)\n'+

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Symmetrically Encrypted Data Packet (Tag 9) * @class
* @classdesc Implementation of the Symmetrically Encrypted Data Packet (Tag 9)
* *
* RFC4880 5.7: The Symmetrically Encrypted Data packet contains data encrypted * RFC4880 5.7: The Symmetrically Encrypted Data packet contains data encrypted
* with a symmetric-key algorithm. When it has been decrypted, it contains other * with a symmetric-key algorithm. When it has been decrypted, it contains other
@ -34,14 +35,11 @@ function openpgp_packet_encrypteddata() {
/** /**
* parsing function for the packet. * parsing function for the packet.
* *
* @param input * @param {string} input payload of a tag 9 packet
* [string] payload of a tag 9 packet * @param {integer} position position to start reading from the input string
* @param position * @param {integer} len length of the packet or the remaining length of
* [integer] position to start reading from the input string
* @param len
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
var mypos = position; var mypos = position;
@ -55,10 +53,10 @@ function openpgp_packet_encrypteddata() {
/** /**
* symmetrically decrypt the packet data * symmetrically decrypt the packet data
* *
* @param symmetric_algorithm_type * @param {integer} symmetric_algorithm_type
* [integer] symmetric key algorithm to use // See RFC4880 9.2 * symmetric key algorithm to use // See RFC4880 9.2
* @param key * @param {String} key
* [String] key as string with the corresponding length to the * key as string with the corresponding length to the
* algorithm * algorithm
* @return the decrypted data; * @return the decrypted data;
*/ */
@ -73,14 +71,11 @@ function openpgp_packet_encrypteddata() {
/** /**
* Creates a string representation of the packet * Creates a string representation of the packet
* *
* @param algo * @param {Integer} algo symmetric key algorithm to use // See RFC4880 9.2
* [Integer] symmetric key algorithm to use // See RFC4880 9.2 * @param {String} key key as string with the corresponding length to the
* @param key
* [String] key as string with the corresponding length to the
* algorithm * algorithm
* @param data * @param {String} data data to be
* [String] data to be * @return {String} string-representation of the packet
* @return [String] string-representation of the packet
*/ */
function write_packet(algo, key, data) { function write_packet(algo, key, data) {
var result = ""; var result = "";

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Sym. Encrypted Integrity Protected Data Packet (Tag 18) * @class
* @classdesc Implementation of the Sym. Encrypted Integrity Protected Data Packet (Tag 18)
* *
* RFC4880 5.13: The Symmetrically Encrypted Integrity Protected Data packet is * RFC4880 5.13: The Symmetrically Encrypted Integrity Protected Data packet is
* a variant of the Symmetrically Encrypted Data packet. It is a new feature * a variant of the Symmetrically Encrypted Data packet. It is a new feature
@ -35,14 +36,12 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
/** /**
* parsing function for the packet. * parsing function for the packet.
* *
* @param input * @param {string} input payload of a tag 18 packet
* [string] payload of a tag 18 packet * @param {integer} position
* @param position * position to start reading from the input string
* [integer] position to start reading from the input string * @param {integer} len length of the packet or the remaining length of
* @param len
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encryptedintegrityprotecteddata] object * @return {openpgp_packet_encryptedintegrityprotecteddata} object
* representation * representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
@ -73,11 +72,9 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
* Creates a string representation of a Sym. Encrypted Integrity Protected * Creates a string representation of a Sym. Encrypted Integrity Protected
* Data Packet (tag 18) (see RFC4880 5.13) * Data Packet (tag 18) (see RFC4880 5.13)
* *
* @param symmetric_algorithm * @param {integer} symmetric_algorithm
* [integer] the selected symmetric encryption algorithm to be * the selected symmetric encryption algorithm to be used
* used * @param {String} key the key of cipher blocksize length to be used
* @param key
* [String] the key of cipher blocksize length to be used
* @param data * @param data
* plaintext data to be encrypted within the packet * plaintext data to be encrypted within the packet
* @return a string representation of the packet * @return a string representation of the packet
@ -110,11 +107,9 @@ function openpgp_packet_encryptedintegrityprotecteddata() {
* Decrypts the encrypted data contained in this object read_packet must * Decrypts the encrypted data contained in this object read_packet must
* have been called before * have been called before
* *
* @param symmetric_algorithm_type * @param {integer} symmetric_algorithm_type
* [integer] the selected symmetric encryption algorithm to be * the selected symmetric encryption algorithm to be used
* used * @param {String} key the key of cipher blocksize length to be used
* @param key
* [String] the key of cipher blocksize length to be used
* @return the decrypted data of this packet * @return the decrypted data of this packet
*/ */
function decrypt(symmetric_algorithm_type, key) { function decrypt(symmetric_algorithm_type, key) {

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Public-Key Encrypted Session Key Packets (Tag 1) * @class
* @classdesc Public-Key Encrypted Session Key Packets (Tag 1)
* *
* RFC4880 5.1: A Public-Key Encrypted Session Key packet holds the session key * RFC4880 5.1: A Public-Key Encrypted Session Key packet holds the session key
* used to encrypt a message. Zero or more Public-Key Encrypted Session Key * used to encrypt a message. Zero or more Public-Key Encrypted Session Key
@ -35,14 +36,11 @@ function openpgp_packet_encryptedsessionkey() {
/** /**
* parsing function for a publickey encrypted session key packet (tag 1). * parsing function for a publickey encrypted session key packet (tag 1).
* *
* @param input * @param {string} input payload of a tag 1 packet
* [string] payload of a tag 1 packet * @param {integer} position position to start reading from the input string
* @param position * @param {integer} len length of the packet or the remaining length of
* [integer] position to start reading from the input string
* @param len
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_pub_key_packet(input, position, len) { function read_pub_key_packet(input, position, len) {
this.tagType = 1; this.tagType = 1;
@ -87,23 +85,19 @@ function openpgp_packet_encryptedsessionkey() {
/** /**
* create a string representation of a tag 1 packet * create a string representation of a tag 1 packet
* *
* @param publicKeyId * @param {String} publicKeyId
* [String] the public key id corresponding to publicMPIs key as * the public key id corresponding to publicMPIs key as string
* string * @param {Array[openpgp_type_mpi]} publicMPIs
* @param publicMPIs * multiprecision integer objects describing the public key
* [Array[openpgp_type_mpi]] multiprecision integer objects * @param {integer} pubalgo
* describing the public key * the corresponding public key algorithm // See RFC4880 9.1
* @param pubalgo * @param {integer} symmalgo
* [integer] the corresponding public key algorithm // See * the symmetric cipher algorithm used to encrypt the data within
* RFC4880 9.1 * an encrypteddatapacket or encryptedintegrityprotecteddatapacket
* @param symmalgo * following this packet //See RFC4880 9.2
* [integer] the symmetric cipher algorithm used to encrypt the * @param {String} sessionkey
* data within an encrypteddatapacket or * a string of randombytes representing the session key
* encryptedintegrityprotecteddatapacket following this packet // * @return {String} the string representation
* See RFC4880 9.2
* @param sessionkey
* [String] a string of randombytes representing the session key
* @return [String] the string representation
*/ */
function write_pub_key_packet(publicKeyId, publicMPIs, pubalgo, symmalgo, function write_pub_key_packet(publicKeyId, publicMPIs, pubalgo, symmalgo,
sessionkey) { sessionkey) {
@ -129,14 +123,12 @@ function openpgp_packet_encryptedsessionkey() {
/** /**
* parsing function for a symmetric encrypted session key packet (tag 3). * parsing function for a symmetric encrypted session key packet (tag 3).
* *
* @param input * @param {string} input payload of a tag 1 packet
* [string] payload of a tag 1 packet * @param {integer} position position to start reading from the input string
* @param position * @param {integer} len
* [integer] position to start reading from the input string * length of the packet or the remaining length of
* @param len
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_symmetric_key_packet(input, position, len) { function read_symmetric_key_packet(input, position, len) {
this.tagType = 3; this.tagType = 3;
@ -164,12 +156,11 @@ function openpgp_packet_encryptedsessionkey() {
* Decrypts the session key (only for public key encrypted session key * Decrypts the session key (only for public key encrypted session key
* packets (tag 1) * packets (tag 1)
* *
* @param msg * @param {openpgp_msg_message} msg
* [openpgp_msg_message] the message object (with member * the message object (with member encryptedData
* encryptedData * @param {openpgp_msg_privatekey} key
* @param key * private key with secMPIs unlocked
* [openpgp_msg_privatekey] private key with secMPIs unlocked * @return {String} the unencrypted session key
* @return [String] the unencrypted session key
*/ */
function decrypt(msg, key) { function decrypt(msg, key) {
if (this.tagType == 1) { if (this.tagType == 1) {

View File

@ -15,14 +15,18 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/**
* @class
* @classdesc Parent openpgp packet class. Operations focus on determining packet types
* and packet header.
*/
function _openpgp_packet() { function _openpgp_packet() {
/** /**
* Encodes a given integer of length to the openpgp length specifier to a * Encodes a given integer of length to the openpgp length specifier to a
* string * string
* *
* @param length * @param {Integer} length of the length to encode
* [Integer] of the length to encode * @return {string} string with openpgp length representation
* @return string with openpgp length representation
*/ */
function encode_length(length) { function encode_length(length) {
result = ""; result = "";
@ -50,11 +54,9 @@ function _openpgp_packet() {
* Writes a packet header version 4 with the given tag_type and length to a * Writes a packet header version 4 with the given tag_type and length to a
* string * string
* *
* @param tag_type * @param {integer} tag_type tag type
* integer of tag type * @param {integer} length length of the payload
* @param length * @return {string} string of the header
* integer length of the payload
* @return string of the header
*/ */
function write_packet_header(tag_type, length) { function write_packet_header(tag_type, length) {
/* we're only generating v4 packet headers here */ /* we're only generating v4 packet headers here */
@ -68,11 +70,9 @@ function _openpgp_packet() {
* Writes a packet header Version 3 with the given tag_type and length to a * Writes a packet header Version 3 with the given tag_type and length to a
* string * string
* *
* @param tag_type * @param {integer} tag_type tag type
* integer of tag type * @param {integer} length length of the payload
* @param length * @return {string} string of the header
* integer length of the payload
* @return string of the header
*/ */
function write_old_packet_header(tag_type, length) { function write_old_packet_header(tag_type, length) {
var result = ""; var result = "";
@ -97,13 +97,10 @@ function _openpgp_packet() {
/** /**
* Generic static Packet Parser function * Generic static Packet Parser function
* *
* @param input * @param {String} input input stream as string
* [String] input stream as string * @param {integer} position position to start parsing
* @param position * @param {integer} len length of the input from position on
* [integer] position to start parsing * @return {openpgp_packet_*} returns a parsed openpgp_packet
* @param len
* [integer] length of the input from position on
* @return [openpgp_packet_*] returns a parsed openpgp_packet
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
// some sanity checks // some sanity checks

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Key Material Packet (Tag 5,6,7,14) * @class
* @classdesc Implementation of the Key Material Packet (Tag 5,6,7,14)
* *
* RFC4480 5.5: * RFC4480 5.5:
* A key material packet contains all the information about a public or * A key material packet contains all the information about a public or
@ -545,11 +546,11 @@ function openpgp_packet_keymaterial() {
/** /**
* Continue parsing packets belonging to the key material such as signatures * Continue parsing packets belonging to the key material such as signatures
* @param parent_node [openpgp_*] the parent object * @param {openpgp_*} parent_node the parent object
* @param input [String] input string to read the packet(s) from * @param {String} input input string to read the packet(s) from
* @param position [integer] start position for the parser * @param {integer} position start position for the parser
* @param len [integer] length of the packet(s) or remaining length of input * @param {integer} len length of the packet(s) or remaining length of input
* @return [integer] length of nodes read * @return {integer} length of nodes read
*/ */
function read_nodes(parent_node, input, position, len) { function read_nodes(parent_node, input, position, len) {
this.parentNode = parent_node; this.parentNode = parent_node;
@ -657,7 +658,7 @@ function openpgp_packet_keymaterial() {
/** /**
* calculates the key id of they key * calculates the key id of they key
* @return [String] a 8 byte key id * @return {String} a 8 byte key id
*/ */
function getKeyId() { function getKeyId() {
if (this.version == 4) { if (this.version == 4) {
@ -672,7 +673,7 @@ function openpgp_packet_keymaterial() {
/** /**
* calculates the fingerprint of the key * calculates the fingerprint of the key
* @return [String] a string containing the fingerprint * @return {String} a string containing the fingerprint
*/ */
function getFingerprint() { function getFingerprint() {
if (this.version == 4) { if (this.version == 4) {
@ -687,8 +688,12 @@ function openpgp_packet_keymaterial() {
/* /*
* creates an OpenPGP key packet for the given key. much TODO in regards to s2k, subkeys. * creates an OpenPGP key packet for the given key. much TODO in regards to s2k, subkeys.
* @param keyType [int] follows the OpenPGP algorithm standard, IE 1 corresponds to RSA. * @param {int} keyType follows the OpenPGP algorithm standard, IE 1 corresponds to RSA.
* @param key [RSA.keyObject] * @param {RSA.keyObject} key
* @param password
* @param s2kHash
* @param symmetricEncryptionAlgorithm
* @param timePacket
* @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body} * @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body}
*/ */
function write_private_key(keyType, key, password, s2kHash, symmetricEncryptionAlgorithm, timePacket){ function write_private_key(keyType, key, password, s2kHash, symmetricEncryptionAlgorithm, timePacket){
@ -764,8 +769,9 @@ function openpgp_packet_keymaterial() {
/* /*
* same as write_private_key, but has less information because of public key. * same as write_private_key, but has less information because of public key.
* @param keyType [int] follows the OpenPGP algorithm standard, IE 1 corresponds to RSA. * @param {int} keyType follows the OpenPGP algorithm standard, IE 1 corresponds to RSA.
* @param key [RSA.keyObject] * @param {RSA.keyObject} key
* @param timePacket
* @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body} * @return {body: [string]OpenPGP packet body contents, header: [string] OpenPGP packet header, string: [string] header+body}
*/ */
function write_public_key(keyType, key, timePacket){ function write_public_key(keyType, key, timePacket){

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Literal Data Packet (Tag 11) * @class
* @classdesc Implementation of the Literal Data Packet (Tag 11)
* *
* RFC4880 5.9: A Literal Data packet contains the body of a message; data that * RFC4880 5.9: A Literal Data packet contains the body of a message; data that
* is not to be further interpreted. * is not to be further interpreted.
@ -27,14 +28,13 @@ function openpgp_packet_literaldata() {
/** /**
* parsing function for a literal data packet (tag 11). * parsing function for a literal data packet (tag 11).
* *
* @param input * @param {string} input payload of a tag 11 packet
* [string] payload of a tag 11 packet * @param {integer} position
* @param position * position to start reading from the input string
* [integer] position to start reading from the input string * @param {integer} len
* @param len * length of the packet or the remaining length of
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.packetLength = len; this.packetLength = len;
@ -53,9 +53,8 @@ function openpgp_packet_literaldata() {
/** /**
* Creates a string representation of the packet * Creates a string representation of the packet
* *
* @param data * @param {String} data the data to be inserted as body
* [String] the data to be inserted as body * @return {String} string-representation of the packet
* @return [String] string-representation of the packet
*/ */
function write_packet(data) { function write_packet(data) {
data = data.replace(/\r\n/g, "\n").replace(/\n/g, "\r\n"); data = data.replace(/\r\n/g, "\n").replace(/\n/g, "\r\n");
@ -83,7 +82,7 @@ function openpgp_packet_literaldata() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* *
* @return String which gives some information about the keymaterial * @return {string} String which gives some information about the keymaterial
*/ */
function toString() { function toString() {
return '5.9. Literal Data Packet (Tag 11)\n' + ' length: ' return '5.9. Literal Data Packet (Tag 11)\n' + ' length: '

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the strange "Marker packet" (Tag 10) * @class
* @classdesc Implementation of the strange "Marker packet" (Tag 10)
* *
* RFC4880 5.8: An experimental version of PGP used this packet as the Literal * RFC4880 5.8: An experimental version of PGP used this packet as the Literal
* packet, but no released version of PGP generated Literal packets with this * packet, but no released version of PGP generated Literal packets with this
@ -30,14 +31,13 @@ function openpgp_packet_marker() {
/** /**
* parsing function for a literal data packet (tag 10). * parsing function for a literal data packet (tag 10).
* *
* @param input * @param {string} input payload of a tag 10 packet
* [string] payload of a tag 10 packet * @param {integer} position
* @param position * position to start reading from the input string
* [integer] position to start reading from the input string * @param {integer} len
* @param len * length of the packet or the remaining length of
* [integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.packetLength = 3; this.packetLength = 3;
@ -52,7 +52,7 @@ function openpgp_packet_marker() {
/** /**
* Generates Debug output * Generates Debug output
* *
* @return String which gives some information about the keymaterial * @return {string} String which gives some information about the keymaterial
*/ */
function toString() { function toString() {
return "5.8. Marker Packet (Obsolete Literal Packet) (Tag 10)\n" return "5.8. Marker Packet (Obsolete Literal Packet) (Tag 10)\n"

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Modification Detection Code Packet (Tag 19) * @class
* @classdesc Implementation of the Modification Detection Code Packet (Tag 19)
* *
* RFC4880 5.14: The Modification Detection Code packet contains a SHA-1 hash of * RFC4880 5.14: The Modification Detection Code packet contains a SHA-1 hash of
* plaintext data, which is used to detect message modification. It is only used * plaintext data, which is used to detect message modification. It is only used
@ -32,14 +33,13 @@ function openpgp_packet_modificationdetectioncode() {
/** /**
* parsing function for a modification detection code packet (tag 19). * parsing function for a modification detection code packet (tag 19).
* *
* @param input * @param {String} input payload of a tag 19 packet
* [String] payload of a tag 19 packet * @param {Integer} position
* @param position * position to start reading from the input string
* [Integer] position to start reading from the input string * @param {Integer} len
* @param len * length of the packet or the remaining length of
* [Integer] length of the packet or the remaining length of
* input at position * input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.packetLength = len; this.packetLength = len;
@ -67,7 +67,7 @@ function openpgp_packet_modificationdetectioncode() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* *
* @return String which gives some information about the modification * @return {string} String which gives some information about the modification
* detection code * detection code
*/ */
function toString() { function toString() {

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the One-Pass Signature Packets (Tag 4) * @class
* @classdesc Implementation of the One-Pass Signature Packets (Tag 4)
* *
* RFC4880 5.4: * RFC4880 5.4:
* The One-Pass Signature packet precedes the signed data and contains * The One-Pass Signature packet precedes the signed data and contains
@ -36,10 +37,10 @@ function openpgp_packet_onepasssignature() {
/** /**
* parsing function for a one-pass signature packet (tag 4). * parsing function for a one-pass signature packet (tag 4).
* @param input [string] payload of a tag 4 packet * @param {string} input payload of a tag 4 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.packetLength = len; this.packetLength = len;
@ -71,14 +72,14 @@ function openpgp_packet_onepasssignature() {
/** /**
* creates a string representation of a one-pass signature packet * creates a string representation of a one-pass signature packet
* @param type [integer] Signature types as described in RFC4880 Section 5.2.1. * @param {integer} type Signature types as described in RFC4880 Section 5.2.1.
* @param hashalgorithm [integer] the hash algorithm used within the signature * @param {integer} hashalgorithm the hash algorithm used within the signature
* @param privatekey [openpgp_msg_privatekey] the private key used to generate the signature * @param {openpgp_msg_privatekey} privatekey the private key used to generate the signature
* @param length [integer] length of data to be signed * @param {integer} length length of data to be signed
* @param nested [boolean] boolean showing whether the signature is nested. * @param {boolean} nested boolean showing whether the signature is nested.
* "true" indicates that the next packet is another One-Pass Signature packet * "true" indicates that the next packet is another One-Pass Signature packet
* that describes another signature to be applied to the same message data. * that describes another signature to be applied to the same message data.
* @return [String] a string representation of a one-pass signature packet * @return {String} a string representation of a one-pass signature packet
*/ */
function write_packet(type, hashalgorithm, privatekey,length, nested) { function write_packet(type, hashalgorithm, privatekey,length, nested) {
var result =""; var result ="";
@ -99,7 +100,7 @@ function openpgp_packet_onepasssignature() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the one-pass signature packet * @return {string} String which gives some information about the one-pass signature packet
*/ */
function toString() { function toString() {
return '5.4. One-Pass Signature Packets (Tag 4)\n'+ return '5.4. One-Pass Signature Packets (Tag 4)\n'+

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the Signature Packet (Tag 2) * @class
* @classdesc Implementation of the Signature Packet (Tag 2)
* *
* RFC4480 5.2: * RFC4480 5.2:
* A Signature packet describes a binding between some public key and * A Signature packet describes a binding between some public key and
@ -68,10 +69,10 @@ function openpgp_packet_signature() {
/** /**
* parsing function for a signature packet (tag 2). * parsing function for a signature packet (tag 2).
* @param input [string] payload of a tag 2 packet * @param {string} input payload of a tag 2 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.data = input.substring (position, position+len); this.data = input.substring (position, position+len);
@ -208,10 +209,10 @@ function openpgp_packet_signature() {
/** /**
* creates a string representation of a message signature packet (tag 2). * creates a string representation of a message signature packet (tag 2).
* This can be only used on text data * This can be only used on text data
* @param signature_type [integer] should be 1 (one) * @param {integer} signature_type should be 1 (one)
* @param data [String] data to be signed * @param {String} data data to be signed
* @param privatekey [openpgp_msg_privatekey] private key used to sign the message. (secMPIs MUST be unlocked) * @param {openpgp_msg_privatekey} privatekey private key used to sign the message. (secMPIs MUST be unlocked)
* @return string representation of a signature packet * @return {string} string representation of a signature packet
*/ */
function write_message_signature(signature_type, data, privatekey) { function write_message_signature(signature_type, data, privatekey) {
var publickey = privatekey.privateKeyPacket.publicKey; var publickey = privatekey.privateKeyPacket.publicKey;
@ -254,9 +255,9 @@ function openpgp_packet_signature() {
} }
/** /**
* creates a string representation of a sub signature packet (See RFC 4880 5.2.3.1) * creates a string representation of a sub signature packet (See RFC 4880 5.2.3.1)
* @param type [integer] subpacket signature type. Signature types as described in RFC4880 Section 5.2.3.2 * @param {integer} type subpacket signature type. Signature types as described in RFC4880 Section 5.2.3.2
* @param data [String] data to be included * @param {String} data data to be included
* @return [String] a string-representation of a sub signature packet (See RFC 4880 5.2.3.1) * @return {String} a string-representation of a sub signature packet (See RFC 4880 5.2.3.1)
*/ */
function write_sub_signature_packet(type, data) { function write_sub_signature_packet(type, data) {
var result = ""; var result = "";
@ -662,7 +663,7 @@ function openpgp_packet_signature() {
} }
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the signature packet * @return {string} String which gives some information about the signature packet
*/ */
function toString () { function toString () {
@ -721,7 +722,7 @@ function openpgp_packet_signature() {
/** /**
* gets the issuer key id of this signature * gets the issuer key id of this signature
* @return [String] issuer key id as string (8bytes) * @return {String} issuer key id as string (8bytes)
*/ */
function getIssuer() { function getIssuer() {
if (this.version == 4) if (this.version == 4)

View File

@ -16,6 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* @class
* @classdesc Implementation of the User Attribute Packet (Tag 17)
* The User Attribute packet is a variation of the User ID packet. It * The User Attribute packet is a variation of the User ID packet. It
* is capable of storing more types of data than the User ID packet, * is capable of storing more types of data than the User ID packet,
* which is limited to text. Like the User ID packet, a User Attribute * which is limited to text. Like the User ID packet, a User Attribute
@ -39,10 +41,10 @@ function openpgp_packet_userattribute() {
/** /**
* parsing function for a user attribute packet (tag 17). * parsing function for a user attribute packet (tag 17).
* @param input [string] payload of a tag 17 packet * @param {string} input payload of a tag 17 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet (input, position, len) { function read_packet (input, position, len) {
var total_len = 0; var total_len = 0;
@ -87,7 +89,7 @@ function openpgp_packet_userattribute() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the user attribute packet * @return {string} String which gives some information about the user attribute packet
*/ */
function toString() { function toString() {
var result = '5.12. User Attribute Packet (Tag 17)\n'+ var result = '5.12. User Attribute Packet (Tag 17)\n'+
@ -100,11 +102,11 @@ function openpgp_packet_userattribute() {
/** /**
* Continue parsing packets belonging to the user attribute packet such as signatures * Continue parsing packets belonging to the user attribute packet such as signatures
* @param parent_node [openpgp_*] the parent object * @param {openpgp_*} parent_node the parent object
* @param input [String] input string to read the packet(s) from * @param {String} input input string to read the packet(s) from
* @param position [integer] start position for the parser * @param {integer} position start position for the parser
* @param len [integer] length of the packet(s) or remaining length of input * @param {integer} len length of the packet(s) or remaining length of input
* @return [integer] length of nodes read * @return {integer} length of nodes read
*/ */
function read_nodes(parent_node, input, position, len) { function read_nodes(parent_node, input, position, len) {

View File

@ -16,6 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* @class
* @classdesc Implementation of the User ID Packet (Tag 13)
* A User ID packet consists of UTF-8 text that is intended to represent * A User ID packet consists of UTF-8 text that is intended to represent
* the name and email address of the key holder. By convention, it * the name and email address of the key holder. By convention, it
* includes an RFC 2822 [RFC2822] mail name-addr, but there are no * includes an RFC 2822 [RFC2822] mail name-addr, but there are no
@ -32,10 +34,10 @@ function openpgp_packet_userid() {
/** /**
* parsing function for a user id packet (tag 13). * parsing function for a user id packet (tag 13).
* @param input [string] payload of a tag 13 packet * @param {string} input payload of a tag 13 packet
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_packet_encrypteddata] object representation * @return {openpgp_packet_encrypteddata} object representation
*/ */
function read_packet(input, position, len) { function read_packet(input, position, len) {
this.text = ''; this.text = '';
@ -49,8 +51,8 @@ function openpgp_packet_userid() {
/** /**
* creates a string representation of the user id packet * creates a string representation of the user id packet
* @param user_id [String] the user id as string ("John Doe <john.doe@mail.us") * @param {String} user_id the user id as string ("John Doe <john.doe@mail.us")
* @return [String] string representation * @return {String} string representation
*/ */
function write_packet(user_id) { function write_packet(user_id) {
this.text = user_id; this.text = user_id;
@ -61,11 +63,11 @@ function openpgp_packet_userid() {
/** /**
* Continue parsing packets belonging to the userid packet such as signatures * Continue parsing packets belonging to the userid packet such as signatures
* @param parent_node [openpgp_*] the parent object * @param {openpgp_*} parent_node the parent object
* @param input [String] input string to read the packet(s) from * @param {String} input input string to read the packet(s) from
* @param position [integer] start position for the parser * @param {integer} position start position for the parser
* @param len [integer] length of the packet(s) or remaining length of input * @param {integer} len length of the packet(s) or remaining length of input
* @return [integer] length of nodes read * @return {integer} length of nodes read
*/ */
function read_nodes(parent_node, input, position, len) { function read_nodes(parent_node, input, position, len) {
if (parent_node.tagType == 6) { // public key if (parent_node.tagType == 6) { // public key
@ -145,7 +147,7 @@ function openpgp_packet_userid() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the user id packet * @return {string} String which gives some information about the user id packet
*/ */
function toString() { function toString() {
var result = ' 5.11. User ID Packet (Tag 13)\n' + ' text (' var result = ' 5.11. User ID Packet (Tag 13)\n' + ' text ('
@ -164,7 +166,7 @@ function openpgp_packet_userid() {
/** /**
* lookup function to find certification revocation signatures * lookup function to find certification revocation signatures
* @param keyId string containing the key id of the issuer of this signature * @param {string} keyId string containing the key id of the issuer of this signature
* @return a CertificationRevocationSignature if found; otherwise null * @return a CertificationRevocationSignature if found; otherwise null
*/ */
function hasCertificationRevocationSignature(keyId) { function hasCertificationRevocationSignature(keyId) {

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of type key id (RFC4880 3.3) * @class
* @classdesc Implementation of type key id (RFC4880 3.3)
* A Key ID is an eight-octet scalar that identifies a key. * A Key ID is an eight-octet scalar that identifies a key.
Implementations SHOULD NOT assume that Key IDs are unique. The Implementations SHOULD NOT assume that Key IDs are unique. The
section "Enhanced Key Formats" below describes how Key IDs are section "Enhanced Key Formats" below describes how Key IDs are
@ -25,8 +26,8 @@
function openpgp_type_keyid() { function openpgp_type_keyid() {
/** /**
* parsing method for a key id * parsing method for a key id
* @param input [String] input to read the key id from * @param {String} input input to read the key id from
* @param position [integer] position where to start reading the key id from input * @param {integer} position position where to start reading the key id from input
* @return this object * @return this object
*/ */
function read_packet(input, position) { function read_packet(input, position) {
@ -36,7 +37,7 @@ function openpgp_type_keyid() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return [String] Key Id as hexadecimal string * @return {String} Key Id as hexadecimal string
*/ */
function toString() { function toString() {
return util.hexstrdump(this.bytes); return util.hexstrdump(this.bytes);

View File

@ -21,13 +21,14 @@
// - MPI = c | d << 8 | e << ((MPI.length -2)*8) | f ((MPI.length -2)*8) // - MPI = c | d << 8 | e << ((MPI.length -2)*8) | f ((MPI.length -2)*8)
/** /**
* Implementation of type MPI (RFC4880 3.2) * @class
* Multiprecision integers (also called MPIs) are unsigned integers used * @classdescImplementation of type MPI (RFC4880 3.2)
* to hold large integers such as the ones used in cryptographic * Multiprecision integers (also called MPIs) are unsigned integers used
* calculations. * to hold large integers such as the ones used in cryptographic
* An MPI consists of two pieces: a two-octet scalar that is the length * calculations.
* of the MPI in bits followed by a string of octets that contain the * An MPI consists of two pieces: a two-octet scalar that is the length
* actual integer. * of the MPI in bits followed by a string of octets that contain the
* actual integer.
*/ */
function openpgp_type_mpi() { function openpgp_type_mpi() {
this.MPI = null; this.MPI = null;
@ -36,10 +37,10 @@ function openpgp_type_mpi() {
this.data = null; this.data = null;
/** /**
* parsing function for a mpi (RFC 4880 3.2). * parsing function for a mpi (RFC 4880 3.2).
* @param input [string] payload of mpi data * @param {string} input payload of mpi data
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @param len [integer] length of the packet or the remaining length of input at position * @param {integer} len length of the packet or the remaining length of input at position
* @return [openpgp_type_mpi] object representation * @return {openpgp_type_mpi} object representation
*/ */
function read(input, position, len) { function read(input, position, len) {
var mypos = position; var mypos = position;
@ -68,7 +69,7 @@ function openpgp_type_mpi() {
/** /**
* generates debug output (pretty print) * generates debug output (pretty print)
* @return String which gives some information about the mpi * @return {string} String which gives some information about the mpi
*/ */
function toString() { function toString() {
var r = " MPI("+this.mpiBitLength+"b/"+this.mpiByteLength+"B) : 0x"; var r = " MPI("+this.mpiBitLength+"b/"+this.mpiByteLength+"B) : 0x";
@ -78,7 +79,7 @@ function openpgp_type_mpi() {
/** /**
* converts the mpi to an BigInteger object * converts the mpi to an BigInteger object
* @return [BigInteger] * @return {BigInteger}
*/ */
function getBigInteger() { function getBigInteger() {
return new BigInteger(util.hexstrdump(this.MPI),16); return new BigInteger(util.hexstrdump(this.MPI),16);
@ -93,7 +94,7 @@ function openpgp_type_mpi() {
/** /**
* gets the length of the mpi in bytes * gets the length of the mpi in bytes
* @return [integer] mpi byte length * @return {integer} mpi byte length
*/ */
function getByteLength() { function getByteLength() {
return this.mpiByteLength; return this.mpiByteLength;
@ -101,8 +102,8 @@ function openpgp_type_mpi() {
/** /**
* creates an mpi from the specified string * creates an mpi from the specified string
* @param data [String] data to read the mpi from * @param {String} data data to read the mpi from
* @return [openpgp_type_mpi] * @return {openpgp_type_mpi}
*/ */
function create(data) { function create(data) {
this.MPI = data; this.MPI = data;
@ -113,7 +114,7 @@ function openpgp_type_mpi() {
/** /**
* converts the mpi object to a string as specified in RFC4880 3.2 * converts the mpi object to a string as specified in RFC4880 3.2
* @return [String] mpi byte representation * @return {String} mpi byte representation
*/ */
function toBin() { function toBin() {
var result = String.fromCharCode((this.mpiBitLength >> 8) & 0xFF); var result = String.fromCharCode((this.mpiBitLength >> 8) & 0xFF);

View File

@ -16,7 +16,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* Implementation of the String-to-key specifier (RFC4880 3.7) * @class
* @classdesc Implementation of the String-to-key specifier (RFC4880 3.7)
* String-to-key (S2K) specifiers are used to convert passphrase strings * String-to-key (S2K) specifiers are used to convert passphrase strings
into symmetric-key encryption/decryption keys. They are used in two into symmetric-key encryption/decryption keys. They are used in two
places, currently: to encrypt the secret part of private keys in the places, currently: to encrypt the secret part of private keys in the
@ -26,9 +27,9 @@
function openpgp_type_s2k() { function openpgp_type_s2k() {
/** /**
* parsing function for a string-to-key specifier (RFC 4880 3.7). * parsing function for a string-to-key specifier (RFC 4880 3.7).
* @param input [string] payload of string-to-key specifier * @param {string} input payload of string-to-key specifier
* @param position [integer] position to start reading from the input string * @param {integer} position position to start reading from the input string
* @return [openpgp_type_s2k] object representation * @return {openpgp_type_s2k} object representation
*/ */
function read(input, position) { function read(input, position) {
var mypos = position; var mypos = position;
@ -76,7 +77,7 @@ function openpgp_type_s2k() {
/** /**
* writes an s2k hash based on the inputs. * writes an s2k hash based on the inputs.
* @return [String] produced key of hashAlgorithm hash length * @return {String} produced key of hashAlgorithm hash length
*/ */
function write(type, hash, passphrase, salt, c){ function write(type, hash, passphrase, salt, c){
this.type = type; this.type = type;
@ -90,8 +91,8 @@ function openpgp_type_s2k() {
/** /**
* produces a key using the specified passphrase and the defined hashAlgorithm * produces a key using the specified passphrase and the defined hashAlgorithm
* @param passphrase [String] passphrase containing user input * @param passphrase {String} passphrase containing user input
* @return [String] produced key with a length corresponding to hashAlgorithm hash length * @return {String} produced key with a length corresponding to hashAlgorithm hash length
*/ */
function produce_key(passphrase, numBytes) { function produce_key(passphrase, numBytes) {
if (this.type == 0) { if (this.type == 0) {