# Module: encoding/armor

## encoding/armor

Source:
  - encoding/armor.js, line 18

### Members

#### <inner> crc_table

  Internal function to calculate a CRC-24 checksum over a given string (data)
  Source:
    - encoding/armor.js, line 132

### Methods

#### <inner> armor(messagetype, body, partindex, parttotal) → {String}

  Armor an OpenPGP binary packet block

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `messagetype` | Integer | type of the message
  `body` |  |
  `partindex` | Integer |
  `parttotal` | Integer |

  Source:
    - encoding/armor.js, line 315

  ##### Returns:

  Armored text
  Type
    String

#### <inner> armor_addheader() → {String}

  Add additional information to the armor version of an OpenPGP binary packet block.
  Version:
    - 2011-12-16
  Author:
    - Alex
  Source:
    - encoding/armor.js, line 88

  ##### Returns:

  The header information
  Type
    String

#### <inner> dearmor(text) → {Object}

  DeArmor an OpenPGP armored message; verify the checksum and return the encoded bytes

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `text` | String | OpenPGP armored message

  Source:
    - encoding/armor.js, line 248

  ##### Returns:

  An object with attribute "text" containing the message text, an attribute "data" containing the bytes and "type" for the ASCII armor type
  Type
    Object

#### <inner> get_type(text) → {Integer}

  Finds out which Ascii Armoring type is used. This is an internal function

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `text` | String | [String] ascii armored text

  Source:
    - encoding/armor.js, line 35

  ##### Returns:

  0 = MESSAGE PART n of m 1 = MESSAGE PART n 2 = SIGNED MESSAGE 3 = PGP MESSAGE 4 = PUBLIC KEY BLOCK 5 = PRIVATE KEY BLOCK null = unknown
  Type
    Integer

#### <inner> getCheckSum(data) → {String}

  Calculates a checksum over the given data and returns it base64 encoded

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `data` | String | Data to create a CRC-24 checksum for

  Source:
    - encoding/armor.js, line 107

  ##### Returns:

  Base64 encoded checksum
  Type
    String

#### <inner> split_checksum(text) → {Boolean|Object}

  Splits a message into two parts, the body and the checksum. This is an internal function

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `text` | String | OpenPGP armored message part

  Source:
    - encoding/armor.js, line 226

  ##### Returns:

  Either false in case of an error or an object with attribute "body" containing the body and an attribute "checksum" containing the checksum.
  Type
    Boolean | Object

#### <inner> split_headers(text) → {Boolean|Object}

  Splits a message into two parts, the headers and the body. This is an internal function

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `text` | String | OpenPGP armored message part

  Source:
    - encoding/armor.js, line 204

  ##### Returns:

  Either false in case of an error or an object with attribute "headers" containing the headers and and an attribute "body" containing the body.
  Type
    Boolean | Object

#### <inner> verifyCheckSum(data, checksum) → {Boolean}

  Calculates the checksum over the given data and compares it with the given base64 encoded checksum

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `data` | String | Data to create a CRC-24 checksum for
  `checksum` | String | Base64 encoded checksum

  Source:
    - encoding/armor.js, line 122

  ##### Returns:

  True if the given checksum is correct; otherwise false
  Type
    Boolean