Commit cf9dd009 authored by Sietse Ringers's avatar Sietse Ringers Committed by Ivar Derksen
Browse files

fix: private key issue of issuer if another issuer with a similar name exists

This solves the following. If:
- an issuer exists in the scheme whose identifier is of the form $scheme.$issuer$suffix,
  where $scheme.$issuer is another existing issuer in the scheme,
- issuer $scheme.$issuer$suffix has a private key installed in the --privkeys folder,

Then the IRMA server refused to startup with an incorrect error message
("Private key 0 of issuer $scheme.$issuer does not belong to corresponding public key").
parent 759f2178
......@@ -153,11 +153,15 @@ func (p *PrivateKeyRingFolder) Latest(id IssuerIdentifier) (*gabikeys.PrivateKey
}
func (p *PrivateKeyRingFolder) Iterate(id IssuerIdentifier, f func(sk *gabikeys.PrivateKey) error) error {
files, err := filepath.Glob(filepath.Join(p.path, fmt.Sprintf("%s*", id.String())))
files, err := filepath.Glob(filepath.Join(p.path, fmt.Sprintf("%s.xml", id.String())))
if err != nil {
return err
}
for _, file := range files {
filesWithCounter, err := filepath.Glob(filepath.Join(p.path, fmt.Sprintf("%s.*.xml", id.String())))
if err != nil {
return err
}
for _, file := range append(files, filesWithCounter...) {
sk, err := p.readFile(filepath.Base(file), id)
if err != nil {
return err
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment