# Module: openpgp

## openpgp

Source:
  - openpgp.js, line 24

### Methods

#### <inner> decryptAndVerifyMessage(privateKey, publicKeys, message) → {Object}

  Decrypts message and verifies signatures

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `privateKey` | module:key~Key | private key with decrypted secret key data
  `publicKeys` | Array.<module:key~Key> | public keys to verify signatures
  `message` | module:message~Message | the message object with signed and encrypted data

  Source:
    - openpgp.js, line 84

  ##### Returns:

  decrypted message as as native JavaScript string with verified signatures or null if no literal data found
  Type
    Object

#### <inner> decryptMessage(privateKey, message) → {String|null}

  Decrypts message

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `privateKey` | module:key~Key | private key with decrypted secret key data
  `message` | module:message~Message | the message object with the encrypted data

  Source:
    - openpgp.js, line 70

  ##### Returns:

  decrypted message as as native JavaScript string or null if no literal data found
  Type
    String | null

#### <inner> encryptMessage(keys, text) → {String}

  Encrypts message text with keys

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `keys` | Array.<module:key~Key> | array of keys, used to encrypt the message
  `text` | String | message as native JavaScript string

  Source:
    - openpgp.js, line 41

  ##### Returns:

  encrypted ASCII armored message
  Type
    String

#### <inner> generateKeyPair(keyType, numBits, userId, passphrase) → {Object}

  Generates a new OpenPGP key pair. Currently only supports RSA keys. Primary and subkey will be of same type.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `keyType` | Integer | to indicate what type of key to make. RSA is 1. See http://tools.ietf.org/html/rfc4880#section-9.1
  `numBits` | Integer | number of bits for the key creation. (should be 1024+, generally)
  `userId` | String | assumes already in form of "User Name "
  `passphrase` | String | The passphrase used to encrypt the resulting private key

  Source:
    - openpgp.js, line 134

  ##### Returns:

  {key: Array, privateKeyArmored: Array, publicKeyArmored: Array}
  Type
    Object

#### <inner> signAndEncryptMessage(publicKeys, privateKey, text) → {String}

  Signs message text and encrypts it

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `publicKeys` | Array.<module:key~Key> | array of keys, used to encrypt the message
  `privateKey` | module:key~Key | private key with decrypted secret key data for signing
  `text` | String | message as native JavaScript string

  Source:
    - openpgp.js, line 55

  ##### Returns:

  encrypted ASCII armored message
  Type
    String

#### <inner> signClearMessage(privateKeys, text) → {String}

  Signs a cleartext message

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `privateKeys` | Array.<module:key~Key> | private key with decrypted secret key data to sign cleartext
  `text` | String | cleartext

  Source:
    - openpgp.js, line 101

  ##### Returns:

  ASCII armored message
  Type
    String

#### <inner> verifyClearSignedMessage(publicKeys, message) → {Object}

  Verifies signatures of cleartext signed message

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `publicKeys` | Array.<module:key~Key> | public keys to verify signatures
  `message` | module:cleartext~CleartextMessage | cleartext message object with signatures

  Source:
    - openpgp.js, line 114

  ##### Returns:

  cleartext with status of verified signatures
  Type
    Object