certificates/authority/provisioners.go

31 lines
849 B
Go
Raw Normal View History

2018-10-05 21:48:36 +00:00
package authority
import (
"net/http"
"github.com/pkg/errors"
"github.com/smallstep/ca-component/provisioner"
2018-10-05 21:48:36 +00:00
)
// GetEncryptedKey returns the JWE key corresponding to the given kid argument.
func (a *Authority) GetEncryptedKey(kid string) (string, error) {
val, ok := a.encryptedKeyIndex.Load(kid)
if !ok {
return "", &apiError{errors.Errorf("encrypted key with kid %s was not found", kid),
http.StatusNotFound, context{}}
}
key, ok := val.(string)
if !ok {
return "", &apiError{errors.Errorf("stored value is not a string"),
http.StatusInternalServerError, context{}}
}
return key, nil
}
// GetProvisioners returns a map listing each provisioner and the JWK Key Set
// with their public keys.
func (a *Authority) GetProvisioners() ([]*provisioner.Provisioner, error) {
return a.config.AuthorityConfig.Provisioners, nil
2018-10-05 21:48:36 +00:00
}