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.
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.
new (require("packet/signature"))()
- Source:
- Source:
Requires
Methods
-
isExpired() → {Boolean}
-
Verifies signature expiration date
- Source:
Returns:
true if expired- Type
- Boolean
-
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 -
sign(key, data)
-
Signs provided data. This needs to be done prior to serialization.
Parameters:
Name Type Description key
module:packet/secret_key private key used to sign the message. data
Object Contains packets to be signed. - Source:
-
verify(data, key) → {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/public_subkey | module:packet/public_key the public key to verify the signature - Source:
Returns:
True if message is verified, else false.- Type
- 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
-
<inner> write_sub_packet(type, data) → {String}
-
creates a string representation of a sub signature packet (See RFC 4880 5.2.3.1)
Parameters:
Name Type Description type
Integer subpacket signature type. Signature types as described in RFC4880 Section 5.2.3.2 data
String data to be included - Source:
Returns:
a string-representation of a sub signature packet (See RFC 4880 5.2.3.1)- Type
- String