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

Add OpenPGP key to provider metadata when generated at setup.

This commit is contained in:
Sascha L. Teichmann 2021-12-01 20:16:09 +01:00
parent f2d8cd1e90
commit 9cf4a7cb5c
3 changed files with 20 additions and 10 deletions

View file

@ -6,6 +6,7 @@ import (
"strings"
"github.com/BurntSushi/toml"
"github.com/ProtonMail/gopenpgp/v2/crypto"
"github.com/csaf-poc/csaf_distribution/csaf"
)
@ -70,6 +71,15 @@ func (cfg *config) modelTLPs() []csaf.TLPLabel {
return tlps
}
func (cfg *config) loadCryptoKey() (*crypto.Key, error) {
f, err := os.Open(cfg.Key)
if err != nil {
return nil, err
}
defer f.Close()
return crypto.NewKeyFromArmoredReader(f)
}
func loadConfig() (*config, error) {
path := os.Getenv(configEnv)
if path == "" {