Module: openpgp

openpgp

Source:

Requires

Methods

<static> 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:
Returns:
decrypted message as as native JavaScript string with verified signatures or null if no literal data found
Type
Object

<static> 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:
Returns:
decrypted message as as native JavaScript string or null if no literal data found
Type
String | null

<static> 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:
Returns:
encrypted ASCII armored message
Type
String

<static> 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:
Returns:
{key: Array, privateKeyArmored: Array, publicKeyArmored: Array}
Type
Object

<static> 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:
Returns:
encrypted ASCII armored message
Type
String

<static> 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:
Returns:
ASCII armored message
Type
String

<static> 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:
Returns:
cleartext with status of verified signatures
Type
Object