Implement GetArmoredWithCustomHeaders (#48)
* Implement GetArmoredWithCustomHeaders ArmorWithTypeAndCustomHeaders can be reused by other PGP armoured objects. * Update linting, and lint accordingly `godot` has been improved and `goerr113` has been added (and ignored here). * Add custom headers for keys * Minor comment changes Co-authored-by: Aron Wussler <aron@wussler.it>
This commit is contained in:
parent
b1e005fec3
commit
dcc82c9fc3
10 changed files with 176 additions and 31 deletions
|
|
@ -48,7 +48,7 @@ type PGPSplitMessage struct {
|
|||
}
|
||||
|
||||
// A ClearTextMessage is a signed but not encrypted PGP message,
|
||||
// i.e. the ones beginning with -----BEGIN PGP SIGNED MESSAGE-----
|
||||
// i.e. the ones beginning with -----BEGIN PGP SIGNED MESSAGE-----.
|
||||
type ClearTextMessage struct {
|
||||
Data []byte
|
||||
Signature []byte
|
||||
|
|
@ -217,6 +217,12 @@ func (msg *PGPMessage) GetArmored() (string, error) {
|
|||
return armor.ArmorWithType(msg.Data, constants.PGPMessageHeader)
|
||||
}
|
||||
|
||||
// GetArmoredWithCustomHeaders returns the armored message as a string, with
|
||||
// the given headers. Empty parameters are omitted from the headers.
|
||||
func (msg *PGPMessage) GetArmoredWithCustomHeaders(comment, version string) (string, error) {
|
||||
return armor.ArmorWithTypeAndCustomHeaders(msg.Data, constants.PGPMessageHeader, version, comment)
|
||||
}
|
||||
|
||||
// GetBinaryDataPacket returns the unarmored binary datapacket as a []byte.
|
||||
func (msg *PGPSplitMessage) GetBinaryDataPacket() []byte {
|
||||
return msg.DataPacket
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue