1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Change OpenPGP signatures to be without headers (#183)

* Change options when creating the armored version of the signature
   to leave out the optional headers, which would be `Version:`
   and `Comment:`, as it is considered uncommon for a while now to
   set these.
This commit is contained in:
Bernhard E. Reiter 2022-06-14 13:18:42 +02:00 committed by GitHub
parent 7e7947a601
commit 2961a70bf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -26,6 +26,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/ProtonMail/gopenpgp/v2/armor"
"github.com/ProtonMail/gopenpgp/v2/constants"
"github.com/ProtonMail/gopenpgp/v2/crypto" "github.com/ProtonMail/gopenpgp/v2/crypto"
"github.com/csaf-poc/csaf_distribution/csaf" "github.com/csaf-poc/csaf_distribution/csaf"
"github.com/csaf-poc/csaf_distribution/util" "github.com/csaf-poc/csaf_distribution/util"
@ -490,7 +492,8 @@ func (w *worker) sign(data []byte) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
return sig.GetArmored() return armor.ArmorWithTypeAndCustomHeaders(
sig.Data, constants.PGPSignatureHeader, "", "")
} }
func (w *worker) mirrorFiles(tlpLabel *csaf.TLPLabel, files []string) error { func (w *worker) mirrorFiles(tlpLabel *csaf.TLPLabel, files []string) error {

View file

@ -21,6 +21,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/ProtonMail/gopenpgp/v2/armor"
"github.com/ProtonMail/gopenpgp/v2/constants"
"github.com/ProtonMail/gopenpgp/v2/crypto" "github.com/ProtonMail/gopenpgp/v2/crypto"
"github.com/csaf-poc/csaf_distribution/csaf" "github.com/csaf-poc/csaf_distribution/csaf"
"github.com/csaf-poc/csaf_distribution/util" "github.com/csaf-poc/csaf_distribution/util"
@ -112,7 +114,8 @@ func (c *controller) handleSignature(
return "", nil, err return "", nil, err
} }
armored, err := sig.GetArmored() armored, err := armor.ArmorWithTypeAndCustomHeaders(
sig.Data, constants.PGPSignatureHeader, "", "")
return armored, key, err return armored, key, err
} }

View file

@ -21,6 +21,8 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/ProtonMail/gopenpgp/v2/armor"
"github.com/ProtonMail/gopenpgp/v2/constants"
"github.com/ProtonMail/gopenpgp/v2/crypto" "github.com/ProtonMail/gopenpgp/v2/crypto"
"github.com/csaf-poc/csaf_distribution/csaf" "github.com/csaf-poc/csaf_distribution/csaf"
"github.com/csaf-poc/csaf_distribution/util" "github.com/csaf-poc/csaf_distribution/util"
@ -239,7 +241,8 @@ func (p *processor) uploadRequest(filename string) (*http.Request, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
armored, err := sig.GetArmored() armored, err := armor.ArmorWithTypeAndCustomHeaders(
sig.Data, constants.PGPSignatureHeader, "", "")
if err != nil { if err != nil {
return nil, err return nil, err
} }