mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Differentiate if fingerprint is empty or not given
This commit is contained in:
parent
9037574d96
commit
4e09dbf41f
4 changed files with 26 additions and 20 deletions
|
|
@ -81,8 +81,8 @@ var fingerprintPattern = patternUnmarshal(`^[0-9a-fA-F]{40,}$`)
|
|||
// PGPKey is location and the fingerprint of the key
|
||||
// used to sign the CSAF documents.
|
||||
type PGPKey struct {
|
||||
Fingerprint Fingerprint `json:"fingerprint,omitempty"`
|
||||
URL *string `json:"url"` // required
|
||||
Fingerprint *Fingerprint `json:"fingerprint,omitempty"`
|
||||
URL *string `json:"url"` // required
|
||||
}
|
||||
|
||||
// Category is the category of the CSAF feed.
|
||||
|
|
@ -616,13 +616,14 @@ func (pmd *ProviderMetadata) SetLastUpdated(t time.Time) {
|
|||
// If there is no such key it is append to the list of keys.
|
||||
func (pmd *ProviderMetadata) SetPGP(fingerprint, url string) {
|
||||
for i := range pmd.PGPKeys {
|
||||
if strings.EqualFold(string(pmd.PGPKeys[i].Fingerprint), fingerprint) {
|
||||
if strings.EqualFold(string(*pmd.PGPKeys[i].Fingerprint), fingerprint) {
|
||||
pmd.PGPKeys[i].URL = &url
|
||||
return
|
||||
}
|
||||
}
|
||||
f := Fingerprint(fingerprint)
|
||||
pmd.PGPKeys = append(pmd.PGPKeys, PGPKey{
|
||||
Fingerprint: Fingerprint(fingerprint),
|
||||
Fingerprint: &f,
|
||||
URL: &url,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue