Class: Signature

packet.Signature(date)

new Signature(date)

Implementation of the Signature Packet (Tag 2)

RFC4480 5.2: A Signature packet describes a binding between some public key and some data. The most common signatures are a signature of a file or a block of text, and a signature that is a certification of a User ID.

Parameters:
Name Type Description
date Date

the creation date of the signature

Source:

Methods

getExpirationTime() → {Date}

Returns the expiration time of the signature or Infinity if signature does not expire

Source:
Returns:

expiration time

Type
Date

isExpired(date) → {Boolean}

Verifies signature expiration date

Parameters:
Name Type Description
date Date

(optional) use the given date for verification instead of the current time

Source:
Returns:

true if expired

Type
Boolean

postCloneTypeFix()

Fix custom types after cloning

Source:

read(bytes, position, len) → {module:packet.Signature}

parsing function for a signature packet (tag 2).

Parameters:
Name Type Description
bytes String

payload of a tag 2 packet

position Integer

position to start reading from the bytes string

len Integer

length of the packet or the remaining length of bytes at position

Source:
Returns:

object representation

Type
module:packet.Signature

(async) sign(key, data) → {Promise.<Boolean>}

Signs provided data. This needs to be done prior to serialization.

Parameters:
Name Type Description
key module:packet.SecretKey

private key used to sign the message.

data Object

Contains packets to be signed.

Source:
Returns:
Type
Promise.<Boolean>

(async) verify(data, key) → {Promise.<Boolean>}

verifys the signature packet. Note: not signature types are implemented

Parameters:
Name Type Description
data String | Object

data which on the signature applies

key module:packet.PublicSubkey | module:packet.PublicKey | module:packet.SecretSubkey | module:packet.SecretKey

the public key to verify the signature

Source:
Returns:

True if message is verified, else false.

Type
Promise.<Boolean>

write_all_sub_packets() → {String}

Creates string of bytes with all subpacket data

Source:
Returns:

a string-representation of a all subpacket data

Type
String