Class: openpgp

openpgp

Main Openpgp.js class. Use this to initiate and make all calls to this library.

new openpgp

GPG4Browsers Core interface. A single instance is hold from the beginning. To use this library call "openpgp.init()"
Source:
  • openpgp.js, line 9578

Methods

<inner> generate_key_pair

generates a new key pair for openpgp. Beta stage. Currently only supports RSA keys, and no subkeys.
Parameters:
Name Type Description
keyType int to indicate what type of key to make. RSA is 1. Follows algorithms outlined in OpenPGP.
numBits int number of bits for the key creation. (should be 1024+, generally)
userId string assumes already in form of "User Name "
Source:
  • openpgp.js, line 9925
Returns:
Type
privateKey: [openpgp_msg_privatekey], privateKeyArmored: [string], publicKeyArmored: [string]

<inner> init

initializes the library: - reading the keyring from local storage - reading the config from local storage
Source:
  • openpgp.js, line 9587
Returns:
[void]

<inner> read_message

reads message packets out of an OpenPGP armored text and returns an array of message objects
Parameters:
Name Type Description
armoredText String text to be parsed
Source:
  • openpgp.js, line 9678
Returns:
on error the function returns null
Type
Array[openpgp_msg_message]

<inner> read_privateKey

reads several privateKey objects from a ascii armored representation an returns openpgp_msg_privatekey objects
Parameters:
Name Type Description
armoredText String OpenPGP armored text containing the private key(s)
Source:
  • openpgp.js, line 9648
Returns:
on error the function returns null
Type
Array[openpgp_msg_privatekey]

<inner> read_publicKey

reads several publicKey objects from a ascii armored representation an returns openpgp_msg_publickey packets
Parameters:
Name Type Description
armoredText String OpenPGP armored text containing the public key(s)
Source:
  • openpgp.js, line 9602
Returns:
on error the function returns null
Type
Array[openpgp_msg_publickey]

<inner> write_encrypted_message

creates a binary string representation of an encrypted message. The message will be encrypted with the public keys specified
Parameters:
Name Type Description
publickeys Array {obj: [openpgp_msg_publickey]} public keys to be used to encrypt the message
messagetext String message text to encrypt
Source:
  • openpgp.js, line 9869
Returns:
a binary string representation of the message which can be OpenPGP armored
Type
String

<inner> write_signed_and_encrypted_message

creates a binary string representation of an encrypted and signed message. The message will be encrypted with the public keys specified and signed with the specified private key.
Parameters:
Name Type Description
privatekey obj: [openpgp_msg_privatekey] private key to be used to sign the message
publickeys Array {obj: [openpgp_msg_publickey]} public keys to be used to encrypt the message
messagetext String message text to encrypt and sign
Source:
  • openpgp.js, line 9812
Returns:
a binary string representation of the message which can be OpenPGP armored
Type
String

<inner> write_signed_message

creates a binary string representation a signed message. The message will be signed with the specified private key.
Parameters:
Name Type Description
privatekey obj: [openpgp_msg_privatekey] private key to be used to sign the message
messagetext String message text to sign
Source:
  • openpgp.js, line 9912
Returns:
, openpgp: {String} a binary string representation of the message which can be OpenPGP armored(openpgp) and a text representation of the message (text). This can be directly used to OpenPGP armor the message
Type
Object: text [String]