provisioners.go 784 B

12345678910111213141516171819202122232425
  1. package authority
  2. import (
  3. "net/http"
  4. "github.com/pkg/errors"
  5. "github.com/smallstep/certificates/authority/provisioner"
  6. )
  7. // GetEncryptedKey returns the JWE key corresponding to the given kid argument.
  8. func (a *Authority) GetEncryptedKey(kid string) (string, error) {
  9. key, ok := a.provisioners.LoadEncryptedKey(kid)
  10. if !ok {
  11. return "", &apiError{errors.Errorf("encrypted key with kid %s was not found", kid),
  12. http.StatusNotFound, context{}}
  13. }
  14. return key, nil
  15. }
  16. // GetProvisioners returns a map listing each provisioner and the JWK Key Set
  17. // with their public keys.
  18. func (a *Authority) GetProvisioners(cursor string, limit int) (provisioner.List, string, error) {
  19. provisioners, nextCursor := a.provisioners.Find(cursor, limit)
  20. return provisioners, nextCursor, nil
  21. }