Commit 072251ce authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Also parse keys

parent 99641cc9
......@@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strconv"
"github.com/mhe/gabi"
)
......@@ -50,12 +51,30 @@ func (store *ConfigurationStore) parseIssuerFolders(path string) error {
}
if exists {
store.issuers[issuer.Identifier().string] = issuer
return store.parseCredentialsFolder(dir + "/Issues/")
if err = store.parseCredentialsFolder(dir + "/Issues/"); err != nil {
return err
}
return store.parseKeysFolder(issuer.Identifier(), dir+"/PublicKeys/")
}
return nil
})
}
func (store *ConfigurationStore) parseKeysFolder(issuer *IssuerIdentifier, path string) error {
for i := 0; ; i++ {
file := path + strconv.Itoa(i) + ".xml"
if _, err := os.Stat(file); err != nil {
break
}
pk, err := gabi.NewPublicKeyFromFile(file)
if err != nil {
return err
}
MetaStore.publickeys[issuer.string] = pk
}
return nil
}
func (store *ConfigurationStore) parseCredentialsFolder(path string) error {
return iterateSubfolders(path, func(dir string) error {
cred := &CredentialDescription{}
......
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