Constructor
new SignaturePacket(date)
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
read(bytes, config) → {SignaturePacket}
parsing function for a signature packet (tag 2).
Parameters:
Name | Type | Description |
---|---|---|
bytes |
String | payload of a tag 2 packet |
config |
Object | (optional) full configuration, defaults to openpgp.config |
- Source:
Returns:
object representation
- Type
- SignaturePacket
(async) sign(key, data, detached, streaming)
Signs provided data. This needs to be done prior to serialization.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
key |
SecretKeyPacket | private key used to sign the message. |
|
data |
Object | Contains packets to be signed. |
|
detached |
Boolean | false | (optional) whether to create a detached signature |
streaming |
Boolean | false | (optional) whether to process data as a stream |
- Source:
Throws:
-
if signing failed
- Type
- Error
(async) verify(key, signatureType, data, detached, streaming, config)
verifies the signature packet. Note: not all signature types are implemented
Parameters:
Name | Type | Default | Description |
---|---|---|---|
key |
PublicSubkeyPacket | PublicKeyPacket | SecretSubkeyPacket | SecretKeyPacket | the public key to verify the signature |
|
signatureType |
module:enums.signature | expected signature type |
|
data |
String | Object | data which on the signature applies |
|
detached |
Boolean | false | (optional) whether to verify a detached signature |
streaming |
Boolean | false | (optional) whether to process data as a stream |
config |
Object | (optional) full configuration, defaults to openpgp.config |
- Source:
Throws:
-
if signature validation failed
- Type
- Error
write_hashed_sub_packets() → {Uint8Array}
Creates Uint8Array of bytes of all subpacket data except Issuer and Embedded Signature subpackets
- Source:
Returns:
subpacket data
- Type
- Uint8Array
write_params() → {Uint8Array|ReadableStream.<Uint8Array>}
- Source:
Returns:
- Type
- Uint8Array | ReadableStream.<Uint8Array>
write_unhashed_sub_packets() → {Uint8Array}
Creates Uint8Array of bytes of Issuer and Embedded Signature subpackets
- Source:
Returns:
subpacket data
- Type
- Uint8Array