소스 검색

Add support for ML-DSA keys

This commit adds support for ML-DSA keys and modernizes Go using go fix.
Mariano Cano 3 달 전
부모
커밋
c2d9139d18
100개의 변경된 파일과 884개의 추가작업 그리고 707개의 파일을 삭제
  1. 11 0
      CHANGELOG.md
  2. 3 3
      acme/account.go
  3. 4 5
      acme/api/account.go
  4. 1 1
      acme/api/account_test.go
  5. 1 2
      acme/api/eab.go
  6. 1 1
      acme/api/handler.go
  7. 5 6
      acme/api/middleware.go
  8. 9 9
      acme/api/middleware_test.go
  9. 4 4
      acme/api/order.go
  10. 1 1
      acme/api/revoke.go
  11. 10 8
      acme/api/revoke_test.go
  12. 1 1
      acme/authorization.go
  13. 57 65
      acme/challenge.go
  14. 90 96
      acme/challenge_test.go
  15. 10 16
      acme/challenge_wire_test.go
  16. 1 1
      acme/common.go
  17. 9 9
      acme/db.go
  18. 8 9
      acme/db/nosql/eab.go
  19. 1 1
      acme/db/nosql/nosql.go
  20. 2 2
      acme/db/nosql/nosql_test.go
  21. 5 5
      acme/db/nosql/order.go
  22. 4 4
      acme/errors_test.go
  23. 2 3
      acme/order.go
  24. 17 17
      acme/order_test.go
  25. 6 3
      api/api.go
  26. 4 4
      api/api_test.go
  27. 1 1
      api/read/read.go
  28. 6 7
      api/read/read_test.go
  29. 7 12
      api/render/render.go
  30. 1 1
      api/render/render_test.go
  31. 1 1
      api/revoke.go
  32. 2 2
      api/sign.go
  33. 3 3
      api/ssh.go
  34. 1 1
      api/sshRevoke.go
  35. 1 1
      authority/admin/api/admin_test.go
  36. 1 1
      authority/admin/db.go
  37. 1 1
      authority/admin/db/nosql/nosql.go
  38. 6 12
      authority/admin/db/nosql/policy_test.go
  39. 5 5
      authority/admin/errors.go
  40. 1 1
      authority/administrator/collection.go
  41. 1 1
      authority/authority.go
  42. 3 3
      authority/authorize.go
  43. 2 6
      authority/config/types.go
  44. 1 1
      authority/export.go
  45. 5 5
      authority/linkedca.go
  46. 2 4
      authority/provisioner/acme_test.go
  47. 4 6
      authority/provisioner/aws.go
  48. 1 1
      authority/provisioner/aws_test.go
  49. 7 15
      authority/provisioner/azure.go
  50. 1 1
      authority/provisioner/azure_test.go
  51. 1 1
      authority/provisioner/gcp.go
  52. 3 4
      authority/provisioner/gcp/projectvalidator.go
  53. 1 1
      authority/provisioner/gcp_test.go
  54. 1 1
      authority/provisioner/jwk_test.go
  55. 4 8
      authority/provisioner/k8sSA.go
  56. 3 5
      authority/provisioner/nebula.go
  57. 6 10
      authority/provisioner/oidc.go
  58. 1 1
      authority/provisioner/oidc_test.go
  59. 4 4
      authority/provisioner/options.go
  60. 2 2
      authority/provisioner/options_test.go
  61. 1 1
      authority/provisioner/provisioner.go
  62. 15 25
      authority/provisioner/sign_options.go
  63. 7 8
      authority/provisioner/sign_ssh_options.go
  64. 2 2
      authority/provisioner/ssh_options.go
  65. 1 2
      authority/provisioner/ssh_test.go
  66. 8 8
      authority/provisioner/utils_test.go
  67. 7 7
      authority/provisioner/webhook_test.go
  68. 1 1
      authority/root.go
  69. 5 7
      authority/ssh.go
  70. 3 3
      authority/ssh_test.go
  71. 1 1
      authority/tls.go
  72. 4 4
      authority/tls_test.go
  73. 11 11
      ca/acmeClient_test.go
  74. 2 4
      ca/bootstrap_test.go
  75. 1 1
      ca/ca_test.go
  76. 2 2
      ca/client.go
  77. 16 16
      ca/client_test.go
  78. 14 14
      ca/provisioner_test.go
  79. 4 39
      ca/tls.go
  80. 1 1
      cas/softcas/softcas_test.go
  81. 3 3
      cas/stepcas/jwk_issuer.go
  82. 2 2
      cas/stepcas/stepcas_test.go
  83. 3 3
      cas/stepcas/x5c_issuer.go
  84. 2 2
      cas/stepcas/x5c_issuer_test.go
  85. 2 2
      cas/vaultcas/vaultcas.go
  86. 5 5
      cas/vaultcas/vaultcas_test.go
  87. 1 1
      cmd/step-ca/main.go
  88. 1 1
      commands/onboard.go
  89. 2 2
      db/db.go
  90. 20 20
      errs/error.go
  91. 1 1
      errs/errors_test.go
  92. 1 1
      examples/basic-client/client.go
  93. 30 30
      go.mod
  94. 58 58
      go.sum
  95. 82 0
      internal/cryptoutil/cryptoutil.go
  96. 196 0
      internal/cryptoutil/cryptoutil_test.go
  97. 2 3
      logging/handler.go
  98. 8 9
      logging/responselogger.go
  99. 1 1
      pki/pki.go
  100. 1 1
      pki/templates.go

+ 11 - 0
CHANGELOG.md

@@ -25,6 +25,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 
 ---
 ---
 
 
+## [TPB] - TBD
+
+### Added
+
+- Support for ML-DSA (FIPS 204) keys, available when built with Go 1.27 or
+  newer. JOSE-based flows (JWK, JWS and JWT tokens) do not support ML-DSA yet.
+
+### Deprecated
+
+- Go 1.25 support. Go 1.26 or newer is now required.
+
 ## [0.30.2] - 2026-03-22
 ## [0.30.2] - 2026-03-22
 
 
 - Update golang.org/grpc to patch security advisory
 - Update golang.org/grpc to patch security advisory

+ 3 - 3
acme/account.go

@@ -19,7 +19,7 @@ type Account struct {
 	Contact                []string         `json:"contact,omitempty"`
 	Contact                []string         `json:"contact,omitempty"`
 	Status                 Status           `json:"status"`
 	Status                 Status           `json:"status"`
 	OrdersURL              string           `json:"orders"`
 	OrdersURL              string           `json:"orders"`
-	ExternalAccountBinding interface{}      `json:"externalAccountBinding,omitempty"`
+	ExternalAccountBinding any              `json:"externalAccountBinding,omitempty"`
 	LocationPrefix         string           `json:"-"`
 	LocationPrefix         string           `json:"-"`
 	ProvisionerID          string           `json:"-"`
 	ProvisionerID          string           `json:"-"`
 	ProvisionerName        string           `json:"-"`
 	ProvisionerName        string           `json:"-"`
@@ -34,7 +34,7 @@ func (a *Account) GetLocation() string {
 }
 }
 
 
 // ToLog enables response logging.
 // ToLog enables response logging.
-func (a *Account) ToLog() (interface{}, error) {
+func (a *Account) ToLog() (any, error) {
 	b, err := json.Marshal(a)
 	b, err := json.Marshal(a)
 	if err != nil {
 	if err != nil {
 		return nil, WrapErrorISE(err, "error marshaling account for logging")
 		return nil, WrapErrorISE(err, "error marshaling account for logging")
@@ -112,7 +112,7 @@ type ExternalAccountKey struct {
 	AccountID     string    `json:"-"`
 	AccountID     string    `json:"-"`
 	HmacKey       []byte    `json:"-"`
 	HmacKey       []byte    `json:"-"`
 	CreatedAt     time.Time `json:"createdAt"`
 	CreatedAt     time.Time `json:"createdAt"`
-	BoundAt       time.Time `json:"boundAt,omitempty"`
+	BoundAt       time.Time `json:"boundAt,omitzero"`
 	Policy        *Policy   `json:"policy,omitempty"`
 	Policy        *Policy   `json:"policy,omitempty"`
 }
 }
 
 

+ 4 - 5
acme/api/account.go

@@ -5,6 +5,7 @@ import (
 	"encoding/json"
 	"encoding/json"
 	"errors"
 	"errors"
 	"net/http"
 	"net/http"
+	"slices"
 
 
 	"github.com/go-chi/chi/v5"
 	"github.com/go-chi/chi/v5"
 
 
@@ -22,10 +23,8 @@ type NewAccountRequest struct {
 }
 }
 
 
 func validateContacts(cs []string) error {
 func validateContacts(cs []string) error {
-	for _, c := range cs {
-		if c == "" {
-			return acme.NewError(acme.ErrorMalformedType, "contact cannot be empty string")
-		}
+	if slices.Contains(cs, "") {
+		return acme.NewError(acme.ErrorMalformedType, "contact cannot be empty string")
 	}
 	}
 	return nil
 	return nil
 }
 }
@@ -218,7 +217,7 @@ func GetOrUpdateAccount(w http.ResponseWriter, r *http.Request) {
 
 
 func logOrdersByAccount(w http.ResponseWriter, oids []string) {
 func logOrdersByAccount(w http.ResponseWriter, oids []string) {
 	if rl, ok := w.(logging.ResponseLogger); ok {
 	if rl, ok := w.(logging.ResponseLogger); ok {
-		m := map[string]interface{}{
+		m := map[string]any{
 			"orders": oids,
 			"orders": oids,
 		}
 		}
 		rl.WithFields(m)
 		rl.WithFields(m)

+ 1 - 1
acme/api/account_test.go

@@ -120,7 +120,7 @@ func createEABJWS(jwk *jose.JSONWebKey, hmacKey []byte, keyID, u string) (*jose.
 			Key:       hmacKey,
 			Key:       hmacKey,
 		},
 		},
 		&jose.SignerOptions{
 		&jose.SignerOptions{
-			ExtraHeaders: map[jose.HeaderKey]interface{}{
+			ExtraHeaders: map[jose.HeaderKey]any{
 				"kid": keyID,
 				"kid": keyID,
 				"url": u,
 				"url": u,
 			},
 			},

+ 1 - 2
acme/api/eab.go

@@ -53,8 +53,7 @@ func validateExternalAccountBinding(ctx context.Context, nar *NewAccountRequest)
 	db := acme.MustDatabaseFromContext(ctx)
 	db := acme.MustDatabaseFromContext(ctx)
 	externalAccountKey, err := db.GetExternalAccountKey(ctx, acmeProv.ID, keyID)
 	externalAccountKey, err := db.GetExternalAccountKey(ctx, acmeProv.ID, keyID)
 	if err != nil {
 	if err != nil {
-		var ae *acme.Error
-		if errors.As(err, &ae) {
+		if _, ok := errors.AsType[*acme.Error](err); ok {
 			return nil, acme.WrapError(acme.ErrorUnauthorizedType, err, "the field 'kid' references an unknown key")
 			return nil, acme.WrapError(acme.ErrorUnauthorizedType, err, "the field 'kid' references an unknown key")
 		}
 		}
 		return nil, acme.WrapErrorISE(err, "error retrieving external account key")
 		return nil, acme.WrapErrorISE(err, "error retrieving external account key")

+ 1 - 1
acme/api/handler.go

@@ -209,7 +209,7 @@ type Directory struct {
 }
 }
 
 
 // ToLog enables response logging for the Directory type.
 // ToLog enables response logging for the Directory type.
-func (d *Directory) ToLog() (interface{}, error) {
+func (d *Directory) ToLog() (any, error) {
 	b, err := json.Marshal(d)
 	b, err := json.Marshal(d)
 	if err != nil {
 	if err != nil {
 		return nil, acme.WrapErrorISE(err, "error marshaling directory for logging")
 		return nil, acme.WrapErrorISE(err, "error marshaling directory for logging")

+ 5 - 6
acme/api/middleware.go

@@ -8,6 +8,7 @@ import (
 	"net/http"
 	"net/http"
 	"net/url"
 	"net/url"
 	"path"
 	"path"
+	"slices"
 	"strings"
 	"strings"
 
 
 	"go.step.sm/crypto/jose"
 	"go.step.sm/crypto/jose"
@@ -23,7 +24,7 @@ type nextHTTP = func(http.ResponseWriter, *http.Request)
 
 
 func logNonce(w http.ResponseWriter, nonce string) {
 func logNonce(w http.ResponseWriter, nonce string) {
 	if rl, ok := w.(logging.ResponseLogger); ok {
 	if rl, ok := w.(logging.ResponseLogger); ok {
-		m := map[string]interface{}{
+		m := map[string]any{
 			"nonce": nonce,
 			"nonce": nonce,
 		}
 		}
 		rl.WithFields(m)
 		rl.WithFields(m)
@@ -82,11 +83,9 @@ func verifyContentType(next nextHTTP) nextHTTP {
 		}
 		}
 
 
 		ct := r.Header.Get("Content-Type")
 		ct := r.Header.Get("Content-Type")
-		for _, e := range expected {
-			if ct == e {
-				next(w, r)
-				return
-			}
+		if slices.Contains(expected, ct) {
+			next(w, r)
+			return
 		}
 		}
 		render.Error(w, r, acme.NewError(acme.ErrorMalformedType,
 		render.Error(w, r, acme.NewError(acme.ErrorMalformedType,
 			"expected content-type to be in %s, but got %s", expected, ct))
 			"expected content-type to be in %s, but got %s", expected, ct))

+ 9 - 9
acme/api/middleware_test.go

@@ -30,7 +30,7 @@ func testNext(w http.ResponseWriter, _ *http.Request) {
 	w.Write(testBody)
 	w.Write(testBody)
 }
 }
 
 
-func newBaseContext(ctx context.Context, args ...interface{}) context.Context {
+func newBaseContext(ctx context.Context, args ...any) context.Context {
 	for _, a := range args {
 	for _, a := range args {
 		switch v := a.(type) {
 		switch v := a.(type) {
 		case acme.DB:
 		case acme.DB:
@@ -1269,7 +1269,7 @@ func TestHandler_validateJWS(t *testing.T) {
 						Protected: jose.Header{
 						Protected: jose.Header{
 							Algorithm:  jose.RS256,
 							Algorithm:  jose.RS256,
 							JSONWebKey: &pub,
 							JSONWebKey: &pub,
-							ExtraHeaders: map[jose.HeaderKey]interface{}{
+							ExtraHeaders: map[jose.HeaderKey]any{
 								"url": u,
 								"url": u,
 							},
 							},
 						},
 						},
@@ -1299,7 +1299,7 @@ func TestHandler_validateJWS(t *testing.T) {
 						Protected: jose.Header{
 						Protected: jose.Header{
 							Algorithm:  jose.RS256,
 							Algorithm:  jose.RS256,
 							JSONWebKey: &pub,
 							JSONWebKey: &pub,
-							ExtraHeaders: map[jose.HeaderKey]interface{}{
+							ExtraHeaders: map[jose.HeaderKey]any{
 								"url": u,
 								"url": u,
 							},
 							},
 						},
 						},
@@ -1357,7 +1357,7 @@ func TestHandler_validateJWS(t *testing.T) {
 					{
 					{
 						Protected: jose.Header{
 						Protected: jose.Header{
 							Algorithm: jose.ES256,
 							Algorithm: jose.ES256,
-							ExtraHeaders: map[jose.HeaderKey]interface{}{
+							ExtraHeaders: map[jose.HeaderKey]any{
 								"url": "foo",
 								"url": "foo",
 							},
 							},
 						},
 						},
@@ -1386,7 +1386,7 @@ func TestHandler_validateJWS(t *testing.T) {
 							Algorithm:  jose.ES256,
 							Algorithm:  jose.ES256,
 							KeyID:      "bar",
 							KeyID:      "bar",
 							JSONWebKey: &pub,
 							JSONWebKey: &pub,
-							ExtraHeaders: map[jose.HeaderKey]interface{}{
+							ExtraHeaders: map[jose.HeaderKey]any{
 								"url": u,
 								"url": u,
 							},
 							},
 						},
 						},
@@ -1410,7 +1410,7 @@ func TestHandler_validateJWS(t *testing.T) {
 					{
 					{
 						Protected: jose.Header{
 						Protected: jose.Header{
 							Algorithm: jose.ES256,
 							Algorithm: jose.ES256,
-							ExtraHeaders: map[jose.HeaderKey]interface{}{
+							ExtraHeaders: map[jose.HeaderKey]any{
 								"url": u,
 								"url": u,
 							},
 							},
 						},
 						},
@@ -1435,7 +1435,7 @@ func TestHandler_validateJWS(t *testing.T) {
 						Protected: jose.Header{
 						Protected: jose.Header{
 							Algorithm: jose.ES256,
 							Algorithm: jose.ES256,
 							KeyID:     "bar",
 							KeyID:     "bar",
-							ExtraHeaders: map[jose.HeaderKey]interface{}{
+							ExtraHeaders: map[jose.HeaderKey]any{
 								"url": u,
 								"url": u,
 							},
 							},
 						},
 						},
@@ -1465,7 +1465,7 @@ func TestHandler_validateJWS(t *testing.T) {
 						Protected: jose.Header{
 						Protected: jose.Header{
 							Algorithm:  jose.ES256,
 							Algorithm:  jose.ES256,
 							JSONWebKey: &pub,
 							JSONWebKey: &pub,
-							ExtraHeaders: map[jose.HeaderKey]interface{}{
+							ExtraHeaders: map[jose.HeaderKey]any{
 								"url": u,
 								"url": u,
 							},
 							},
 						},
 						},
@@ -1495,7 +1495,7 @@ func TestHandler_validateJWS(t *testing.T) {
 						Protected: jose.Header{
 						Protected: jose.Header{
 							Algorithm:  jose.RS256,
 							Algorithm:  jose.RS256,
 							JSONWebKey: &pub,
 							JSONWebKey: &pub,
-							ExtraHeaders: map[jose.HeaderKey]interface{}{
+							ExtraHeaders: map[jose.HeaderKey]any{
 								"url": u,
 								"url": u,
 							},
 							},
 						},
 						},

+ 4 - 4
acme/api/order.go

@@ -26,8 +26,8 @@ import (
 // NewOrderRequest represents the body for a NewOrder request.
 // NewOrderRequest represents the body for a NewOrder request.
 type NewOrderRequest struct {
 type NewOrderRequest struct {
 	Identifiers []acme.Identifier `json:"identifiers"`
 	Identifiers []acme.Identifier `json:"identifiers"`
-	NotBefore   time.Time         `json:"notBefore,omitempty,omitzero"`
-	NotAfter    time.Time         `json:"notAfter,omitempty,omitzero"`
+	NotBefore   time.Time         `json:"notBefore,omitzero"`
+	NotAfter    time.Time         `json:"notAfter,omitzero"`
 }
 }
 
 
 // Validate validates a new-order request body.
 // Validate validates a new-order request body.
@@ -310,8 +310,8 @@ func newACMEPolicyEngine(eak *acme.ExternalAccountKey) (policy.X509Policy, error
 }
 }
 
 
 func trimIfWildcard(value string) (string, bool) {
 func trimIfWildcard(value string) (string, bool) {
-	if strings.HasPrefix(value, "*.") {
-		return strings.TrimPrefix(value, "*."), true
+	if after, ok := strings.CutPrefix(value, "*."); ok {
+		return after, true
 	}
 	}
 	return value, false
 	return value, false
 }
 }

+ 1 - 1
acme/api/revoke.go

@@ -212,7 +212,7 @@ func wrapUnauthorizedError(cert *x509.Certificate, unauthorizedIdentifiers []acm
 // logRevoke logs successful revocation of certificate
 // logRevoke logs successful revocation of certificate
 func logRevoke(w http.ResponseWriter, ri *authority.RevokeOptions) {
 func logRevoke(w http.ResponseWriter, ri *authority.RevokeOptions) {
 	if rl, ok := w.(logging.ResponseLogger); ok {
 	if rl, ok := w.(logging.ResponseLogger); ok {
-		rl.WithFields(map[string]interface{}{
+		rl.WithFields(map[string]any{
 			"serial":      ri.Serial,
 			"serial":      ri.Serial,
 			"reasonCode":  ri.ReasonCode,
 			"reasonCode":  ri.ReasonCode,
 			"reason":      ri.Reason,
 			"reason":      ri.Reason,

+ 10 - 8
acme/api/revoke_test.go

@@ -37,8 +37,10 @@ import (
 )
 )
 
 
 // v is a utility function to return the pointer to an integer
 // v is a utility function to return the pointer to an integer
+//
+//go:fix inline
 func v(v int) *int {
 func v(v int) *int {
-	return &v
+	return new(v)
 }
 }
 
 
 func generateSerial() (*big.Int, error) {
 func generateSerial() (*big.Int, error) {
@@ -103,7 +105,7 @@ const noKeyID = keyID("")
 // If nonce is empty, it will not be encoded into the header.
 // If nonce is empty, it will not be encoded into the header.
 // Implementation taken from github.com/mholt/acmez, which seems to be based on
 // Implementation taken from github.com/mholt/acmez, which seems to be based on
 // https://github.com/golang/crypto/blob/master/acme/jws.go.
 // https://github.com/golang/crypto/blob/master/acme/jws.go.
-func jwsEncodeJSON(claimset interface{}, key crypto.Signer, kid keyID, nonce, u string) ([]byte, error) {
+func jwsEncodeJSON(claimset any, key crypto.Signer, kid keyID, nonce, u string) ([]byte, error) {
 	alg, sha := jwsHasher(key.Public())
 	alg, sha := jwsHasher(key.Public())
 	if alg == "" || !sha.Available() {
 	if alg == "" || !sha.Available() {
 		return nil, errUnsupportedKey
 		return nil, errUnsupportedKey
@@ -331,17 +333,17 @@ func Test_validateReasonCode(t *testing.T) {
 		},
 		},
 		{
 		{
 			name:       "fail/too-low",
 			name:       "fail/too-low",
-			reasonCode: v(-1),
+			reasonCode: new(-1),
 			want:       acme.NewError(acme.ErrorBadRevocationReasonType, "reasonCode out of bounds"),
 			want:       acme.NewError(acme.ErrorBadRevocationReasonType, "reasonCode out of bounds"),
 		},
 		},
 		{
 		{
 			name:       "fail/too-high",
 			name:       "fail/too-high",
-			reasonCode: v(11),
+			reasonCode: new(11),
 			want:       acme.NewError(acme.ErrorBadRevocationReasonType, "reasonCode out of bounds"),
 			want:       acme.NewError(acme.ErrorBadRevocationReasonType, "reasonCode out of bounds"),
 		},
 		},
 		{
 		{
 			name:       "fail/missing-7",
 			name:       "fail/missing-7",
-			reasonCode: v(7),
+			reasonCode: new(7),
 
 
 			want: acme.NewError(acme.ErrorBadRevocationReasonType, "reasonCode out of bounds"),
 			want: acme.NewError(acme.ErrorBadRevocationReasonType, "reasonCode out of bounds"),
 		},
 		},
@@ -509,7 +511,7 @@ func TestHandler_RevokeCert(t *testing.T) {
 				Protected: jose.Header{
 				Protected: jose.Header{
 					Algorithm: jose.ES256,
 					Algorithm: jose.ES256,
 					KeyID:     "bar",
 					KeyID:     "bar",
-					ExtraHeaders: map[jose.HeaderKey]interface{}{
+					ExtraHeaders: map[jose.HeaderKey]any{
 						"url": revokeURL,
 						"url": revokeURL,
 					},
 					},
 				},
 				},
@@ -788,7 +790,7 @@ func TestHandler_RevokeCert(t *testing.T) {
 			assert.FatalError(t, err)
 			assert.FatalError(t, err)
 			jwsPayload := &revokePayload{
 			jwsPayload := &revokePayload{
 				Certificate: base64.RawURLEncoding.EncodeToString(cert.Raw),
 				Certificate: base64.RawURLEncoding.EncodeToString(cert.Raw),
-				ReasonCode:  v(2),
+				ReasonCode:  new(2),
 			}
 			}
 			jwsBytes, err := jwsEncodeJSON(rp, unauthorizedKey, "", "nonce", revokeURL)
 			jwsBytes, err := jwsEncodeJSON(rp, unauthorizedKey, "", "nonce", revokeURL)
 			assert.FatalError(t, err)
 			assert.FatalError(t, err)
@@ -888,7 +890,7 @@ func TestHandler_RevokeCert(t *testing.T) {
 		"fail/invalid-reasoncode": func(t *testing.T) test {
 		"fail/invalid-reasoncode": func(t *testing.T) test {
 			invalidReasonPayload := &revokePayload{
 			invalidReasonPayload := &revokePayload{
 				Certificate: base64.RawURLEncoding.EncodeToString(cert.Raw),
 				Certificate: base64.RawURLEncoding.EncodeToString(cert.Raw),
-				ReasonCode:  v(7),
+				ReasonCode:  new(7),
 			}
 			}
 			invalidReasonCodePayloadBytes, err := json.Marshal(invalidReasonPayload)
 			invalidReasonCodePayloadBytes, err := json.Marshal(invalidReasonPayload)
 			assert.FatalError(t, err)
 			assert.FatalError(t, err)

+ 1 - 1
acme/authorization.go

@@ -21,7 +21,7 @@ type Authorization struct {
 }
 }
 
 
 // ToLog enables response logging.
 // ToLog enables response logging.
-func (az *Authorization) ToLog() (interface{}, error) {
+func (az *Authorization) ToLog() (any, error) {
 	b, err := json.Marshal(az)
 	b, err := json.Marshal(az)
 	if err != nil {
 	if err != nil {
 		return nil, WrapErrorISE(err, "error marshaling authz for logging")
 		return nil, WrapErrorISE(err, "error marshaling authz for logging")

+ 57 - 65
acme/challenge.go

@@ -35,6 +35,7 @@ import (
 	"github.com/smallstep/go-attestation/attest"
 	"github.com/smallstep/go-attestation/attest"
 	"go.step.sm/crypto/jose"
 	"go.step.sm/crypto/jose"
 	"go.step.sm/crypto/keyutil"
 	"go.step.sm/crypto/keyutil"
+	"go.step.sm/crypto/mldsa"
 	"go.step.sm/crypto/pemutil"
 	"go.step.sm/crypto/pemutil"
 	"go.step.sm/crypto/x509util"
 	"go.step.sm/crypto/x509util"
 
 
@@ -96,7 +97,7 @@ type Challenge struct {
 }
 }
 
 
 // ToLog enables response logging.
 // ToLog enables response logging.
-func (ch *Challenge) ToLog() (interface{}, error) {
+func (ch *Challenge) ToLog() (any, error) {
 	b, err := json.Marshal(ch)
 	b, err := json.Marshal(ch)
 	if err != nil {
 	if err != nil {
 		return nil, WrapErrorISE(err, "error marshaling challenge for logging")
 		return nil, WrapErrorISE(err, "error marshaling challenge for logging")
@@ -228,8 +229,7 @@ func dns01ChallengeHost(domain string) string {
 }
 }
 
 
 func tlsAlert(err error) uint8 {
 func tlsAlert(err error) uint8 {
-	var opErr *net.OpError
-	if errors.As(err, &opErr) {
+	if opErr, ok := errors.AsType[*net.OpError](err); ok {
 		v := reflect.ValueOf(opErr.Err)
 		v := reflect.ValueOf(opErr.Err)
 		if v.Kind() == reflect.Uint8 {
 		if v.Kind() == reflect.Uint8 {
 			return cast.Uint8(v.Uint())
 			return cast.Uint8(v.Uint())
@@ -378,11 +378,8 @@ func dns01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.JSONWebK
 	h := sha256.Sum256([]byte(expectedKeyAuth))
 	h := sha256.Sum256([]byte(expectedKeyAuth))
 	expected := base64.RawURLEncoding.EncodeToString(h[:])
 	expected := base64.RawURLEncoding.EncodeToString(h[:])
 	var found bool
 	var found bool
-	for _, r := range txtRecords {
-		if r == expected {
-			found = true
-			break
-		}
+	if slices.Contains(txtRecords, expected) {
+		found = true
 	}
 	}
 	if !found {
 	if !found {
 		return storeError(ctx, db, ch, false, NewError(ErrorRejectedIdentifierType,
 		return storeError(ctx, db, ch, false, NewError(ErrorRejectedIdentifierType,
@@ -787,8 +784,8 @@ type payloadType struct {
 }
 }
 
 
 type attestationObject struct {
 type attestationObject struct {
-	Format       string                 `json:"fmt"`
-	AttStatement map[string]interface{} `json:"attStmt,omitempty"`
+	Format       string         `json:"fmt"`
+	AttStatement map[string]any `json:"attStmt,omitempty"`
 }
 }
 
 
 // TODO(bweeks): move attestation verification to a shared package.
 // TODO(bweeks): move attestation verification to a shared package.
@@ -851,8 +848,7 @@ func deviceAttest01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose
 	case "android-key":
 	case "android-key":
 		data, err := doAndroidKeyAttestationFormat(ctx, prov, ch, jwk, &att)
 		data, err := doAndroidKeyAttestationFormat(ctx, prov, ch, jwk, &att)
 		if err != nil {
 		if err != nil {
-			var acmeError *Error
-			if errors.As(err, &acmeError) {
+			if acmeError, ok := errors.AsType[*Error](err); ok {
 				if acmeError.Status == 500 {
 				if acmeError.Status == 500 {
 					return acmeError
 					return acmeError
 				}
 				}
@@ -881,8 +877,7 @@ func deviceAttest01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose
 	case "apple":
 	case "apple":
 		data, err := doAppleAttestationFormat(ctx, prov, ch, &att)
 		data, err := doAppleAttestationFormat(ctx, prov, ch, &att)
 		if err != nil {
 		if err != nil {
-			var acmeError *Error
-			if errors.As(err, &acmeError) {
+			if acmeError, ok := errors.AsType[*Error](err); ok {
 				if acmeError.Status == 500 {
 				if acmeError.Status == 500 {
 					return acmeError
 					return acmeError
 				}
 				}
@@ -917,8 +912,7 @@ func deviceAttest01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose
 	case "step":
 	case "step":
 		data, err := doStepAttestationFormat(ctx, prov, ch, jwk, &att)
 		data, err := doStepAttestationFormat(ctx, prov, ch, jwk, &att)
 		if err != nil {
 		if err != nil {
-			var acmeError *Error
-			if errors.As(err, &acmeError) {
+			if acmeError, ok := errors.AsType[*Error](err); ok {
 				if acmeError.Status == 500 {
 				if acmeError.Status == 500 {
 					return acmeError
 					return acmeError
 				}
 				}
@@ -946,8 +940,7 @@ func deviceAttest01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose
 	case "tpm":
 	case "tpm":
 		data, err := doTPMAttestationFormat(ctx, prov, ch, jwk, &att)
 		data, err := doTPMAttestationFormat(ctx, prov, ch, jwk, &att)
 		if err != nil {
 		if err != nil {
-			var acmeError *Error
-			if errors.As(err, &acmeError) {
+			if acmeError, ok := errors.AsType[*Error](err); ok {
 				if acmeError.Status == 500 {
 				if acmeError.Status == 500 {
 					return acmeError
 					return acmeError
 				}
 				}
@@ -1027,7 +1020,7 @@ func doTPMAttestationFormat(_ context.Context, prov Provisioner, ch *Challenge,
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "version %q is not supported", ver)
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "version %q is not supported", ver)
 	}
 	}
 
 
-	x5c, ok := att.AttStatement["x5c"].([]interface{})
+	x5c, ok := att.AttStatement["x5c"].([]any)
 	if !ok {
 	if !ok {
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "x5c not present")
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "x5c not present")
 	}
 	}
@@ -1340,7 +1333,7 @@ func doAppleAttestationFormat(_ context.Context, prov Provisioner, _ *Challenge,
 		roots.AddCert(root)
 		roots.AddCert(root)
 	}
 	}
 
 
-	x5c, ok := att.AttStatement["x5c"].([]interface{})
+	x5c, ok := att.AttStatement["x5c"].([]any)
 	if !ok {
 	if !ok {
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "x5c not present")
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "x5c not present")
 	}
 	}
@@ -1468,8 +1461,8 @@ type androidKeyAttestationData struct {
 // extension? That should immediately precede the cert with the key attestation
 // extension? That should immediately precede the cert with the key attestation
 // extension.
 // extension.
 func findAndroidAttestationCert(certs []*x509.Certificate) *x509.Certificate {
 func findAndroidAttestationCert(certs []*x509.Certificate) *x509.Certificate {
-	for i := len(certs) - 1; i >= 0; i-- {
-		cert := certs[i]
+	for _, cert := range slices.Backward(certs) {
+
 		for _, ext := range cert.Extensions {
 		for _, ext := range cert.Extensions {
 			if ext.Id.Equal(oidAndroidAttestation) {
 			if ext.Id.Equal(oidAndroidAttestation) {
 				return cert
 				return cert
@@ -1610,26 +1603,9 @@ func doAndroidKeyAttestationFormat(ctx context.Context, prov Provisioner, ch *Ch
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "no attestation certificate with OID 1.3.6.1.4.1.11129.2.1.17 found in the cert chain")
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "no attestation certificate with OID 1.3.6.1.4.1.11129.2.1.17 found in the cert chain")
 	}
 	}
 
 
-	switch pub := attCert.PublicKey.(type) {
-	case *ecdsa.PublicKey:
-		if pub.Curve != elliptic.P256() {
-			return nil, NewDetailedError(ErrorBadAttestationStatementType, "unsupported elliptic curve %s", pub.Curve)
-		}
-		sum := sha256.Sum256([]byte(keyAuth))
-		if !ecdsa.VerifyASN1(pub, sum[:], sig) {
-			return nil, NewDetailedError(ErrorBadAttestationStatementType, "failed validating signature")
-		}
-	case *rsa.PublicKey:
-		sum := sha256.Sum256([]byte(keyAuth))
-		if err := rsa.VerifyPKCS1v15(pub, crypto.SHA256, sum[:], sig); err != nil {
-			return nil, NewDetailedError(ErrorBadAttestationStatementType, "failed validating signature")
-		}
-	case ed25519.PublicKey:
-		if !ed25519.Verify(pub, []byte(keyAuth), sig) {
-			return nil, NewDetailedError(ErrorBadAttestationStatementType, "failed validating signature")
-		}
-	default:
-		return nil, NewDetailedError(ErrorBadAttestationStatementType, "unsupported public key type %T", pub)
+	// Verify attestation statement sig
+	if err := validateAttestationSignature(attCert, keyAuth, sig); err != nil {
+		return nil, err
 	}
 	}
 
 
 	data := &androidKeyAttestationData{
 	data := &androidKeyAttestationData{
@@ -1737,7 +1713,7 @@ func doStepAttestationFormat(_ context.Context, prov Provisioner, ch *Challenge,
 	}
 	}
 
 
 	// Extract x5c and verify certificate
 	// Extract x5c and verify certificate
-	x5c, ok := att.AttStatement["x5c"].([]interface{})
+	x5c, ok := att.AttStatement["x5c"].([]any)
 	if !ok {
 	if !ok {
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "x5c not present")
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "x5c not present")
 	}
 	}
@@ -1785,31 +1761,15 @@ func doStepAttestationFormat(_ context.Context, prov Provisioner, ch *Challenge,
 	if err := cbor.Unmarshal(csig, &sig); err != nil {
 	if err := cbor.Unmarshal(csig, &sig); err != nil {
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "sig is malformed")
 		return nil, NewDetailedError(ErrorBadAttestationStatementType, "sig is malformed")
 	}
 	}
+
 	keyAuth, err := KeyAuthorization(ch.Token, jwk)
 	keyAuth, err := KeyAuthorization(ch.Token, jwk)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	switch pub := leaf.PublicKey.(type) {
-	case *ecdsa.PublicKey:
-		if pub.Curve != elliptic.P256() {
-			return nil, NewDetailedError(ErrorBadAttestationStatementType, "unsupported elliptic curve %s", pub.Curve)
-		}
-		sum := sha256.Sum256([]byte(keyAuth))
-		if !ecdsa.VerifyASN1(pub, sum[:], sig) {
-			return nil, NewDetailedError(ErrorBadAttestationStatementType, "failed to validate signature")
-		}
-	case *rsa.PublicKey:
-		sum := sha256.Sum256([]byte(keyAuth))
-		if err := rsa.VerifyPKCS1v15(pub, crypto.SHA256, sum[:], sig); err != nil {
-			return nil, NewDetailedError(ErrorBadAttestationStatementType, "failed to validate signature")
-		}
-	case ed25519.PublicKey:
-		if !ed25519.Verify(pub, []byte(keyAuth), sig) {
-			return nil, NewDetailedError(ErrorBadAttestationStatementType, "failed to validate signature")
-		}
-	default:
-		return nil, NewDetailedError(ErrorBadAttestationStatementType, "unsupported public key type %T", pub)
+	// Verify attestation statement sig
+	if err := validateAttestationSignature(leaf, keyAuth, sig); err != nil {
+		return nil, err
 	}
 	}
 
 
 	// Parse attestation data:
 	// Parse attestation data:
@@ -1829,6 +1789,38 @@ func doStepAttestationFormat(_ context.Context, prov Provisioner, ch *Challenge,
 	return data, nil
 	return data, nil
 }
 }
 
 
+// validateAttestationSignature verifies that sig is a signature of the key
+// authorization made with the private key of the given attestation certificate.
+func validateAttestationSignature(cert *x509.Certificate, keyAuth string, sig []byte) error {
+	switch pub := cert.PublicKey.(type) {
+	case *ecdsa.PublicKey:
+		if pub.Curve != elliptic.P256() {
+			return NewDetailedError(ErrorBadAttestationStatementType, "unsupported elliptic curve %s", pub.Curve)
+		}
+		sum := sha256.Sum256([]byte(keyAuth))
+		if !ecdsa.VerifyASN1(pub, sum[:], sig) {
+			return NewDetailedError(ErrorBadAttestationStatementType, "failed validating signature")
+		}
+	case *rsa.PublicKey:
+		sum := sha256.Sum256([]byte(keyAuth))
+		if err := rsa.VerifyPKCS1v15(pub, crypto.SHA256, sum[:], sig); err != nil {
+			return NewDetailedError(ErrorBadAttestationStatementType, "failed validating signature")
+		}
+	case ed25519.PublicKey:
+		if !ed25519.Verify(pub, []byte(keyAuth), sig) {
+			return NewDetailedError(ErrorBadAttestationStatementType, "failed validating signature")
+		}
+	case *mldsa.PublicKey:
+		if err := mldsa.Verify(pub, []byte(keyAuth), sig, nil); err != nil {
+			return NewDetailedError(ErrorBadAttestationStatementType, "failed validating signature")
+		}
+	default:
+		return NewDetailedError(ErrorBadAttestationStatementType, "unsupported public key type %T", pub)
+	}
+
+	return nil
+}
+
 // searchSerialNumber searches the certificate extensions, looking for a serial
 // searchSerialNumber searches the certificate extensions, looking for a serial
 // number encoded in one of them. It is not guaranteed that a certificate contains
 // number encoded in one of them. It is not guaranteed that a certificate contains
 // an extension carrying a serial number, so the result can be empty.
 // an extension carrying a serial number, so the result can be empty.
@@ -1880,8 +1872,8 @@ func reverseAddr(ip net.IP) (arpa string) {
 	// Must be IPv6
 	// Must be IPv6
 	buf := make([]byte, 0, len(ip)*4+len("ip6.arpa."))
 	buf := make([]byte, 0, len(ip)*4+len("ip6.arpa."))
 	// Add it, in reverse, to the buffer
 	// Add it, in reverse, to the buffer
-	for i := len(ip) - 1; i >= 0; i-- {
-		v := ip[i]
+	for _, v := range slices.Backward(ip) {
+
 		buf = append(buf, hexit[v&0xF],
 		buf = append(buf, hexit[v&0xF],
 			'.',
 			'.',
 			hexit[v>>4],
 			hexit[v>>4],

+ 90 - 96
acme/challenge_test.go

@@ -217,12 +217,12 @@ func mustAttestApple(t *testing.T, nonce string) ([]byte, *x509.Certificate, *x5
 	fatalError(t, err)
 	fatalError(t, err)
 
 
 	attObj, err := cbor.Marshal(struct {
 	attObj, err := cbor.Marshal(struct {
-		Format       string                 `json:"fmt"`
-		AttStatement map[string]interface{} `json:"attStmt,omitempty"`
+		Format       string         `json:"fmt"`
+		AttStatement map[string]any `json:"attStmt,omitempty"`
 	}{
 	}{
 		Format: "apple",
 		Format: "apple",
-		AttStatement: map[string]interface{}{
-			"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+		AttStatement: map[string]any{
+			"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 		},
 		},
 	})
 	})
 	fatalError(t, err)
 	fatalError(t, err)
@@ -265,12 +265,12 @@ func mustAttestYubikey(t *testing.T, _, keyAuthorization string, serial int) ([]
 	fatalError(t, err)
 	fatalError(t, err)
 
 
 	attObj, err := cbor.Marshal(struct {
 	attObj, err := cbor.Marshal(struct {
-		Format       string                 `json:"fmt"`
-		AttStatement map[string]interface{} `json:"attStmt,omitempty"`
+		Format       string         `json:"fmt"`
+		AttStatement map[string]any `json:"attStmt,omitempty"`
 	}{
 	}{
 		Format: "step",
 		Format: "step",
-		AttStatement: map[string]interface{}{
-			"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+		AttStatement: map[string]any{
+			"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 			"alg": -7,
 			"alg": -7,
 			"sig": cborSig,
 			"sig": cborSig,
 		},
 		},
@@ -319,12 +319,12 @@ func mustAttestStepManagedDeviceID(t *testing.T, _, keyAuthorization, serialNumb
 	require.NoError(t, err)
 	require.NoError(t, err)
 
 
 	attObj, err := cbor.Marshal(struct {
 	attObj, err := cbor.Marshal(struct {
-		Format       string                 `json:"fmt"`
-		AttStatement map[string]interface{} `json:"attStmt,omitempty"`
+		Format       string         `json:"fmt"`
+		AttStatement map[string]any `json:"attStmt,omitempty"`
 	}{
 	}{
 		Format: "step",
 		Format: "step",
-		AttStatement: map[string]interface{}{
-			"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+		AttStatement: map[string]any{
+			"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 			"alg": -7,
 			"alg": -7,
 			"sig": cborSig,
 			"sig": cborSig,
 		},
 		},
@@ -486,8 +486,7 @@ func Test_storeError(t *testing.T) {
 			tc := run(t)
 			tc := run(t)
 			if err := storeError(context.Background(), tc.db, tc.ch, tc.markInvalid, err); err != nil {
 			if err := storeError(context.Background(), tc.db, tc.ch, tc.markInvalid, err); err != nil {
 				if assert.Error(t, tc.err) {
 				if assert.Error(t, tc.err) {
-					var k *Error
-					if errors.As(err, &k) {
+					if k, ok := errors.AsType[*Error](err); ok {
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Status, k.Status)
 						assert.Equal(t, tc.err.Status, k.Status)
@@ -540,8 +539,7 @@ func TestKeyAuthorization(t *testing.T) {
 			tc := run(t)
 			tc := run(t)
 			if ka, err := KeyAuthorization(tc.token, tc.jwk); err != nil {
 			if ka, err := KeyAuthorization(tc.token, tc.jwk); err != nil {
 				if assert.Error(t, tc.err) {
 				if assert.Error(t, tc.err) {
-					var k *Error
-					if errors.As(err, &k) {
+					if k, ok := errors.AsType[*Error](err); ok {
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Status, k.Status)
 						assert.Equal(t, tc.err.Status, k.Status)
@@ -1124,7 +1122,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 						assert.Equal(t, "accID", accountID)
 						assert.Equal(t, "accID", accountID)
 						return []string{"orderID"}, nil
 						return []string{"orderID"}, nil
 					},
 					},
-					MockCreateOidcToken: func(ctx context.Context, orderID string, idToken map[string]interface{}) error {
+					MockCreateOidcToken: func(ctx context.Context, orderID string, idToken map[string]any) error {
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "Alice Smith", idToken["name"].(string))
 						assert.Equal(t, "Alice Smith", idToken["name"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", idToken["preferred_username"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", idToken["preferred_username"].(string))
@@ -1369,7 +1367,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 						assert.Equal(t, "accID", accountID)
 						assert.Equal(t, "accID", accountID)
 						return []string{"orderID"}, nil
 						return []string{"orderID"}, nil
 					},
 					},
-					MockCreateDpopToken: func(ctx context.Context, orderID string, dpop map[string]interface{}) error {
+					MockCreateDpopToken: func(ctx context.Context, orderID string, dpop map[string]any) error {
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "token", dpop["chal"].(string))
 						assert.Equal(t, "token", dpop["chal"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", dpop["handle"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", dpop["handle"].(string))
@@ -1530,8 +1528,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 			ctx = NewClientContext(ctx, tc.vc)
 			ctx = NewClientContext(ctx, tc.vc)
 			err := tc.ch.Validate(ctx, tc.db, tc.jwk, tc.payload)
 			err := tc.ch.Validate(ctx, tc.db, tc.jwk, tc.payload)
 			if tc.err != nil {
 			if tc.err != nil {
-				var k *Error
-				if errors.As(err, &k) {
+				if k, ok := errors.AsType[*Error](err); ok {
 					assert.Equal(t, tc.err.Type, k.Type)
 					assert.Equal(t, tc.err.Type, k.Type)
 					assert.Equal(t, tc.err.Detail, k.Detail)
 					assert.Equal(t, tc.err.Detail, k.Detail)
 					assert.Equal(t, tc.err.Status, k.Status)
 					assert.Equal(t, tc.err.Status, k.Status)
@@ -1969,8 +1966,7 @@ func TestHTTP01Validate(t *testing.T) {
 			ctx := NewClientContext(context.Background(), tc.vc)
 			ctx := NewClientContext(context.Background(), tc.vc)
 			if err := http01Validate(ctx, tc.ch, tc.db, tc.jwk); err != nil {
 			if err := http01Validate(ctx, tc.ch, tc.db, tc.jwk); err != nil {
 				if assert.Error(t, tc.err) {
 				if assert.Error(t, tc.err) {
-					var k *Error
-					if errors.As(err, &k) {
+					if k, ok := errors.AsType[*Error](err); ok {
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Status, k.Status)
 						assert.Equal(t, tc.err.Status, k.Status)
@@ -2270,8 +2266,7 @@ func TestDNS01Validate(t *testing.T) {
 			ctx := NewClientContext(context.Background(), tc.vc)
 			ctx := NewClientContext(context.Background(), tc.vc)
 			if err := dns01Validate(ctx, tc.ch, tc.db, tc.jwk); err != nil {
 			if err := dns01Validate(ctx, tc.ch, tc.db, tc.jwk); err != nil {
 				if assert.Error(t, tc.err) {
 				if assert.Error(t, tc.err) {
-					var k *Error
-					if errors.As(err, &k) {
+					if k, ok := errors.AsType[*Error](err); ok {
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Status, k.Status)
 						assert.Equal(t, tc.err.Status, k.Status)
@@ -3367,8 +3362,7 @@ func TestTLSALPN01Validate(t *testing.T) {
 			ctx := NewClientContext(context.Background(), tc.vc)
 			ctx := NewClientContext(context.Background(), tc.vc)
 			if err := tlsalpn01Validate(ctx, tc.ch, tc.db, tc.jwk); err != nil {
 			if err := tlsalpn01Validate(ctx, tc.ch, tc.db, tc.jwk); err != nil {
 				if assert.Error(t, tc.err) {
 				if assert.Error(t, tc.err) {
-					var k *Error
-					if errors.As(err, &k) {
+					if k, ok := errors.AsType[*Error](err); ok {
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Type, k.Type)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Detail, k.Detail)
 						assert.Equal(t, tc.err.Status, k.Status)
 						assert.Equal(t, tc.err.Status, k.Status)
@@ -3563,8 +3557,8 @@ func Test_doAppleAttestationFormat(t *testing.T) {
 	}{
 	}{
 		{"ok", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 		{"ok", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 			Format: "apple",
 			Format: "apple",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 			},
 			},
 		}}, &appleAttestationData{
 		}}, &appleAttestationData{
 			Nonce:        []byte("nonce"),
 			Nonce:        []byte("nonce"),
@@ -3576,50 +3570,50 @@ func Test_doAppleAttestationFormat(t *testing.T) {
 		}, false},
 		}, false},
 		{"fail apple issuer", args{ctx, mustAttestationProvisioner(t, nil), &Challenge{}, &attestationObject{
 		{"fail apple issuer", args{ctx, mustAttestationProvisioner(t, nil), &Challenge{}, &attestationObject{
 			Format: "apple",
 			Format: "apple",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail missing x5c", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 		{"fail missing x5c", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 			Format: "apple",
 			Format: "apple",
-			AttStatement: map[string]interface{}{
+			AttStatement: map[string]any{
 				"foo": "bar",
 				"foo": "bar",
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail empty issuer", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 		{"fail empty issuer", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 			Format: "apple",
 			Format: "apple",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{},
+			AttStatement: map[string]any{
+				"x5c": []any{},
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail leaf type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 		{"fail leaf type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 			Format: "apple",
 			Format: "apple",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{"leaf", ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{"leaf", ca.Intermediate.Raw},
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail leaf parse", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 		{"fail leaf parse", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 			Format: "apple",
 			Format: "apple",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw[:100], ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw[:100], ca.Intermediate.Raw},
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail intermediate type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 		{"fail intermediate type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 			Format: "apple",
 			Format: "apple",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, "intermediate"},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, "intermediate"},
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail intermediate parse", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 		{"fail intermediate parse", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 			Format: "apple",
 			Format: "apple",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw[:100]},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw[:100]},
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail verify", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 		{"fail verify", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{}, &attestationObject{
 			Format: "apple",
 			Format: "apple",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw},
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 	}
 	}
@@ -3725,8 +3719,8 @@ func Test_doStepAttestationFormat(t *testing.T) {
 	}{
 	}{
 		{"ok", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"ok", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
@@ -3737,8 +3731,8 @@ func Test_doStepAttestationFormat(t *testing.T) {
 		}, false},
 		}, false},
 		{"ok/step-managed-device-id", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"ok/step-managed-device-id", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leafWithStepManagedDeviceID.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leafWithStepManagedDeviceID.Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
@@ -3749,15 +3743,15 @@ func Test_doStepAttestationFormat(t *testing.T) {
 		}, false},
 		}, false},
 		{"fail yubico issuer", args{ctx, mustAttestationProvisioner(t, nil), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail yubico issuer", args{ctx, mustAttestationProvisioner(t, nil), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail x5c type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail x5c type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
+			AttStatement: map[string]any{
 				"x5c": [][]byte{leaf.Raw, ca.Intermediate.Raw},
 				"x5c": [][]byte{leaf.Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
@@ -3765,112 +3759,112 @@ func Test_doStepAttestationFormat(t *testing.T) {
 		}}, nil, true},
 		}}, nil, true},
 		{"fail x5c empty", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail x5c empty", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{},
+			AttStatement: map[string]any{
+				"x5c": []any{},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail leaf type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail leaf type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{"leaf", ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{"leaf", ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail leaf parse", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail leaf parse", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw[:100], ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw[:100], ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail intermediate type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail intermediate type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, "intermediate"},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, "intermediate"},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail intermediate parse", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail intermediate parse", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw[:100]},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw[:100]},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail verify", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail verify", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail sig type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail sig type", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": string(cborSig),
 				"sig": string(cborSig),
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail sig unmarshal", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail sig unmarshal", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": []byte("bad-sig"),
 				"sig": []byte("bad-sig"),
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail keyAuthorization", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, &jose.JSONWebKey{Key: []byte("not an asymmetric key")}, &attestationObject{
 		{"fail keyAuthorization", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, &jose.JSONWebKey{Key: []byte("not an asymmetric key")}, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail sig verify P-256", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail sig verify P-256", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": otherCBORSig,
 				"sig": otherCBORSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail sig verify P-384", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail sig verify P-384", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{makeLeaf(mustSigner("EC", "P-384", 0), serialNumber).Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{makeLeaf(mustSigner("EC", "P-384", 0), serialNumber).Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail sig verify RSA", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail sig verify RSA", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{makeLeaf(mustSigner("RSA", "", 2048), serialNumber).Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{makeLeaf(mustSigner("RSA", "", 2048), serialNumber).Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail sig verify Ed25519", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail sig verify Ed25519", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{makeLeaf(mustSigner("OKP", "Ed25519", 0), serialNumber).Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{makeLeaf(mustSigner("OKP", "Ed25519", 0), serialNumber).Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
 		}}, nil, true},
 		}}, nil, true},
 		{"fail unmarshal serial number", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail unmarshal serial number", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{makeLeaf(signer, []byte("bad-serial")).Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{makeLeaf(signer, []byte("bad-serial")).Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
@@ -3963,8 +3957,8 @@ func Test_doStepAttestationFormat_noCAIntermediate(t *testing.T) {
 	}{
 	}{
 		{"fail no intermediate", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 		{"fail no intermediate", args{ctx, mustAttestationProvisioner(t, caRoot), &Challenge{Token: "token"}, jwk, &attestationObject{
 			Format: "step",
 			Format: "step",
-			AttStatement: map[string]interface{}{
-				"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+			AttStatement: map[string]any{
+				"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 				"alg": -7,
 				"alg": -7,
 				"sig": cborSig,
 				"sig": cborSig,
 			},
 			},
@@ -4011,11 +4005,11 @@ func Test_deviceAttest01Validate(t *testing.T) {
 	})
 	})
 	require.NoError(t, err)
 	require.NoError(t, err)
 	attObj, err := cbor.Marshal(struct {
 	attObj, err := cbor.Marshal(struct {
-		Format       string                 `json:"fmt"`
-		AttStatement map[string]interface{} `json:"attStmt,omitempty"`
+		Format       string         `json:"fmt"`
+		AttStatement map[string]any `json:"attStmt,omitempty"`
 	}{
 	}{
 		Format: "step",
 		Format: "step",
-		AttStatement: map[string]interface{}{
+		AttStatement: map[string]any{
 			"alg": -7,
 			"alg": -7,
 			"sig": "",
 			"sig": "",
 		},
 		},
@@ -4028,11 +4022,11 @@ func Test_deviceAttest01Validate(t *testing.T) {
 	})
 	})
 	require.NoError(t, err)
 	require.NoError(t, err)
 	unsupportedFormatAttObj, err := cbor.Marshal(struct {
 	unsupportedFormatAttObj, err := cbor.Marshal(struct {
-		Format       string                 `json:"fmt"`
-		AttStatement map[string]interface{} `json:"attStmt,omitempty"`
+		Format       string         `json:"fmt"`
+		AttStatement map[string]any `json:"attStmt,omitempty"`
 	}{
 	}{
 		Format: "unsupported-format",
 		Format: "unsupported-format",
-		AttStatement: map[string]interface{}{
+		AttStatement: map[string]any{
 			"alg": -7,
 			"alg": -7,
 			"sig": "",
 			"sig": "",
 		},
 		},
@@ -4432,11 +4426,11 @@ func Test_deviceAttest01Validate(t *testing.T) {
 		"ok/doAppleAttestationFormat-storeError": func(t *testing.T) test {
 		"ok/doAppleAttestationFormat-storeError": func(t *testing.T) test {
 			ctx := NewProvisionerContext(context.Background(), mustAttestationProvisioner(t, nil))
 			ctx := NewProvisionerContext(context.Background(), mustAttestationProvisioner(t, nil))
 			attObj, err := cbor.Marshal(struct {
 			attObj, err := cbor.Marshal(struct {
-				Format       string                 `json:"fmt"`
-				AttStatement map[string]interface{} `json:"attStmt,omitempty"`
+				Format       string         `json:"fmt"`
+				AttStatement map[string]any `json:"attStmt,omitempty"`
 			}{
 			}{
 				Format:       "apple",
 				Format:       "apple",
-				AttStatement: map[string]interface{}{},
+				AttStatement: map[string]any{},
 			})
 			})
 			require.NoError(t, err)
 			require.NoError(t, err)
 			payload, err := json.Marshal(struct {
 			payload, err := json.Marshal(struct {
@@ -4695,11 +4689,11 @@ func Test_deviceAttest01Validate(t *testing.T) {
 			require.NoError(t, err)
 			require.NoError(t, err)
 			ctx := NewProvisionerContext(context.Background(), mustAttestationProvisioner(t, caRoot))
 			ctx := NewProvisionerContext(context.Background(), mustAttestationProvisioner(t, caRoot))
 			attObj, err := cbor.Marshal(struct {
 			attObj, err := cbor.Marshal(struct {
-				Format       string                 `json:"fmt"`
-				AttStatement map[string]interface{} `json:"attStmt,omitempty"`
+				Format       string         `json:"fmt"`
+				AttStatement map[string]any `json:"attStmt,omitempty"`
 			}{
 			}{
 				Format: "step",
 				Format: "step",
-				AttStatement: map[string]interface{}{
+				AttStatement: map[string]any{
 					"alg": -7,
 					"alg": -7,
 					"sig": cborSig,
 					"sig": cborSig,
 				},
 				},
@@ -4847,12 +4841,12 @@ func Test_deviceAttest01Validate(t *testing.T) {
 			require.NoError(t, err)
 			require.NoError(t, err)
 			leaf := makeLeaf(signer, serialNumber)
 			leaf := makeLeaf(signer, serialNumber)
 			attObj, err := cbor.Marshal(struct {
 			attObj, err := cbor.Marshal(struct {
-				Format       string                 `json:"fmt"`
-				AttStatement map[string]interface{} `json:"attStmt,omitempty"`
+				Format       string         `json:"fmt"`
+				AttStatement map[string]any `json:"attStmt,omitempty"`
 			}{
 			}{
 				Format: "bogus-format",
 				Format: "bogus-format",
-				AttStatement: map[string]interface{}{
-					"x5c": []interface{}{leaf.Raw, ca.Intermediate.Raw},
+				AttStatement: map[string]any{
+					"x5c": []any{leaf.Raw, ca.Intermediate.Raw},
 					"alg": -7,
 					"alg": -7,
 					"sig": cborSig,
 					"sig": cborSig,
 				},
 				},

+ 10 - 16
acme/challenge_wire_test.go

@@ -276,8 +276,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 							assert.Equal(t, StatusInvalid, ch.Status)
 							assert.Equal(t, StatusInvalid, ch.Status)
 							assert.Equal(t, string(valueBytes), ch.Value)
 							assert.Equal(t, string(valueBytes), ch.Value)
 							if assert.NotNil(t, ch.Error) {
 							if assert.NotNil(t, ch.Error) {
-								var k *Error // NOTE: the error is not returned up, but stored with the challenge instead
-								if errors.As(ch.Error, &k) {
+								if k, ok := errors.AsType[*Error](ch.Error); ok {
 									assert.Equal(t, "urn:ietf:params:acme:error:rejectedIdentifier", k.Type)
 									assert.Equal(t, "urn:ietf:params:acme:error:rejectedIdentifier", k.Type)
 									assert.Equal(t, "The server will not issue certificates for the identifier", k.Detail)
 									assert.Equal(t, "The server will not issue certificates for the identifier", k.Detail)
 									assert.Equal(t, 400, k.Status)
 									assert.Equal(t, 400, k.Status)
@@ -885,7 +884,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 						assert.Equal(t, "accID", accountID)
 						assert.Equal(t, "accID", accountID)
 						return []string{"orderID"}, nil
 						return []string{"orderID"}, nil
 					},
 					},
-					MockCreateDpopToken: func(ctx context.Context, orderID string, dpop map[string]interface{}) error {
+					MockCreateDpopToken: func(ctx context.Context, orderID string, dpop map[string]any) error {
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "token", dpop["chal"].(string))
 						assert.Equal(t, "token", dpop["chal"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", dpop["handle"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", dpop["handle"].(string))
@@ -2646,7 +2645,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 						assert.Equal(t, "accID", accountID)
 						assert.Equal(t, "accID", accountID)
 						return []string{"orderID"}, nil
 						return []string{"orderID"}, nil
 					},
 					},
-					MockCreateDpopToken: func(ctx context.Context, orderID string, dpop map[string]interface{}) error {
+					MockCreateDpopToken: func(ctx context.Context, orderID string, dpop map[string]any) error {
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "token", dpop["chal"].(string))
 						assert.Equal(t, "token", dpop["chal"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", dpop["handle"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", dpop["handle"].(string))
@@ -2662,8 +2661,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 			tc := run(t)
 			tc := run(t)
 			err := wireDPOP01Validate(tc.ctx, tc.ch, tc.db, tc.jwk, tc.payload)
 			err := wireDPOP01Validate(tc.ctx, tc.ch, tc.db, tc.jwk, tc.payload)
 			if tc.expectedErr != nil {
 			if tc.expectedErr != nil {
-				var k *Error
-				if errors.As(err, &k) {
+				if k, ok := errors.AsType[*Error](err); ok {
 					assert.Equal(t, tc.expectedErr.Type, k.Type)
 					assert.Equal(t, tc.expectedErr.Type, k.Type)
 					assert.Equal(t, tc.expectedErr.Detail, k.Detail)
 					assert.Equal(t, tc.expectedErr.Detail, k.Detail)
 					assert.Equal(t, tc.expectedErr.Status, k.Status)
 					assert.Equal(t, tc.expectedErr.Status, k.Status)
@@ -2923,8 +2921,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 							assert.Equal(t, ChallengeType("wire-oidc-01"), updch.Type)
 							assert.Equal(t, ChallengeType("wire-oidc-01"), updch.Type)
 							assert.Equal(t, string(valueBytes), updch.Value)
 							assert.Equal(t, string(valueBytes), updch.Value)
 							if assert.NotNil(t, updch.Error) {
 							if assert.NotNil(t, updch.Error) {
-								var k *Error // NOTE: the error is not returned up, but stored with the challenge instead
-								if errors.As(updch.Error, &k) {
+								if k, ok := errors.AsType[*Error](updch.Error); ok {
 									assert.Equal(t, "urn:ietf:params:acme:error:rejectedIdentifier", k.Type)
 									assert.Equal(t, "urn:ietf:params:acme:error:rejectedIdentifier", k.Type)
 									assert.Equal(t, "The server will not issue certificates for the identifier", k.Detail)
 									assert.Equal(t, "The server will not issue certificates for the identifier", k.Detail)
 									assert.Equal(t, 400, k.Status)
 									assert.Equal(t, 400, k.Status)
@@ -3031,8 +3028,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 							assert.Equal(t, ChallengeType("wire-oidc-01"), updch.Type)
 							assert.Equal(t, ChallengeType("wire-oidc-01"), updch.Type)
 							assert.Equal(t, string(valueBytes), updch.Value)
 							assert.Equal(t, string(valueBytes), updch.Value)
 							if assert.NotNil(t, updch.Error) {
 							if assert.NotNil(t, updch.Error) {
-								var k *Error // NOTE: the error is not returned up, but stored with the challenge instead
-								if errors.As(updch.Error, &k) {
+								if k, ok := errors.AsType[*Error](updch.Error); ok {
 									assert.Equal(t, "urn:ietf:params:acme:error:rejectedIdentifier", k.Type)
 									assert.Equal(t, "urn:ietf:params:acme:error:rejectedIdentifier", k.Type)
 									assert.Equal(t, "The server will not issue certificates for the identifier", k.Detail)
 									assert.Equal(t, "The server will not issue certificates for the identifier", k.Detail)
 									assert.Equal(t, 400, k.Status)
 									assert.Equal(t, 400, k.Status)
@@ -3242,8 +3238,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 							assert.Equal(t, ChallengeType("wire-oidc-01"), updch.Type)
 							assert.Equal(t, ChallengeType("wire-oidc-01"), updch.Type)
 							assert.Equal(t, string(valueBytes), updch.Value)
 							assert.Equal(t, string(valueBytes), updch.Value)
 							if assert.NotNil(t, updch.Error) {
 							if assert.NotNil(t, updch.Error) {
-								var k *Error // NOTE: the error is not returned up, but stored with the challenge instead
-								if errors.As(updch.Error, &k) {
+								if k, ok := errors.AsType[*Error](updch.Error); ok {
 									assert.Equal(t, "urn:ietf:params:acme:error:rejectedIdentifier", k.Type)
 									assert.Equal(t, "urn:ietf:params:acme:error:rejectedIdentifier", k.Type)
 									assert.Equal(t, "The server will not issue certificates for the identifier", k.Detail)
 									assert.Equal(t, "The server will not issue certificates for the identifier", k.Detail)
 									assert.Equal(t, 400, k.Status)
 									assert.Equal(t, 400, k.Status)
@@ -3679,7 +3674,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 						assert.Equal(t, "accID", accountID)
 						assert.Equal(t, "accID", accountID)
 						return []string{"orderID"}, nil
 						return []string{"orderID"}, nil
 					},
 					},
-					MockCreateOidcToken: func(ctx context.Context, orderID string, idToken map[string]interface{}) error {
+					MockCreateOidcToken: func(ctx context.Context, orderID string, idToken map[string]any) error {
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "Alice Smith", idToken["name"].(string))
 						assert.Equal(t, "Alice Smith", idToken["name"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", idToken["preferred_username"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", idToken["preferred_username"].(string))
@@ -3899,7 +3894,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 						assert.Equal(t, "accID", accountID)
 						assert.Equal(t, "accID", accountID)
 						return []string{"orderID"}, nil
 						return []string{"orderID"}, nil
 					},
 					},
-					MockCreateOidcToken: func(ctx context.Context, orderID string, idToken map[string]interface{}) error {
+					MockCreateOidcToken: func(ctx context.Context, orderID string, idToken map[string]any) error {
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "orderID", orderID)
 						assert.Equal(t, "Alice Smith", idToken["name"].(string))
 						assert.Equal(t, "Alice Smith", idToken["name"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", idToken["preferred_username"].(string))
 						assert.Equal(t, "wireapp://%40alice_wire@wire.com", idToken["preferred_username"].(string))
@@ -3917,8 +3912,7 @@ MCowBQYDK2VwAyEA5c+4NKZSNQcR1T8qN6SjwgdPZQ0Ge12Ylx/YeGAJ35k=
 			}
 			}
 			err := wireOIDC01Validate(tc.ctx, tc.ch, tc.db, tc.jwk, tc.payload)
 			err := wireOIDC01Validate(tc.ctx, tc.ch, tc.db, tc.jwk, tc.payload)
 			if tc.expectedErr != nil {
 			if tc.expectedErr != nil {
-				var k *Error
-				if errors.As(err, &k) {
+				if k, ok := errors.AsType[*Error](err); ok {
 					assert.Equal(t, tc.expectedErr.Type, k.Type)
 					assert.Equal(t, tc.expectedErr.Type, k.Type)
 					assert.Equal(t, tc.expectedErr.Detail, k.Detail)
 					assert.Equal(t, tc.expectedErr.Detail, k.Detail)
 					assert.Equal(t, tc.expectedErr.Status, k.Status)
 					assert.Equal(t, tc.expectedErr.Status, k.Status)

+ 1 - 1
acme/common.go

@@ -109,7 +109,7 @@ func MustProvisionerFromContext(ctx context.Context) Provisioner {
 
 
 // MockProvisioner for testing
 // MockProvisioner for testing
 type MockProvisioner struct {
 type MockProvisioner struct {
-	Mret1                     interface{}
+	Mret1                     any
 	Merr                      error
 	Merr                      error
 	MgetID                    func() string
 	MgetID                    func() string
 	MgetName                  func() string
 	MgetName                  func() string

+ 9 - 9
acme/db.go

@@ -63,10 +63,10 @@ type DB interface {
 type WireDB interface {
 type WireDB interface {
 	DB
 	DB
 	GetAllOrdersByAccountID(ctx context.Context, accountID string) ([]string, error)
 	GetAllOrdersByAccountID(ctx context.Context, accountID string) ([]string, error)
-	CreateDpopToken(ctx context.Context, orderID string, dpop map[string]interface{}) error
-	GetDpopToken(ctx context.Context, orderID string) (map[string]interface{}, error)
-	CreateOidcToken(ctx context.Context, orderID string, idToken map[string]interface{}) error
-	GetOidcToken(ctx context.Context, orderID string) (map[string]interface{}, error)
+	CreateDpopToken(ctx context.Context, orderID string, dpop map[string]any) error
+	GetDpopToken(ctx context.Context, orderID string) (map[string]any, error)
+	CreateOidcToken(ctx context.Context, orderID string, idToken map[string]any) error
+	GetOidcToken(ctx context.Context, orderID string) (map[string]any, error)
 }
 }
 
 
 type dbKey struct{}
 type dbKey struct{}
@@ -132,7 +132,7 @@ type MockDB struct {
 	MockGetOrdersByAccountID func(ctx context.Context, accountID string) ([]string, error)
 	MockGetOrdersByAccountID func(ctx context.Context, accountID string) ([]string, error)
 	MockUpdateOrder          func(ctx context.Context, o *Order) error
 	MockUpdateOrder          func(ctx context.Context, o *Order) error
 
 
-	MockRet1  interface{}
+	MockRet1  any
 	MockError error
 	MockError error
 }
 }
 
 
@@ -142,10 +142,10 @@ type MockDB struct {
 type MockWireDB struct {
 type MockWireDB struct {
 	MockDB
 	MockDB
 	MockGetAllOrdersByAccountID func(ctx context.Context, accountID string) ([]string, error)
 	MockGetAllOrdersByAccountID func(ctx context.Context, accountID string) ([]string, error)
-	MockGetDpopToken            func(ctx context.Context, orderID string) (map[string]interface{}, error)
-	MockCreateDpopToken         func(ctx context.Context, orderID string, dpop map[string]interface{}) error
-	MockGetOidcToken            func(ctx context.Context, orderID string) (map[string]interface{}, error)
-	MockCreateOidcToken         func(ctx context.Context, orderID string, idToken map[string]interface{}) error
+	MockGetDpopToken            func(ctx context.Context, orderID string) (map[string]any, error)
+	MockCreateDpopToken         func(ctx context.Context, orderID string, dpop map[string]any) error
+	MockGetOidcToken            func(ctx context.Context, orderID string) (map[string]any, error)
+	MockCreateOidcToken         func(ctx context.Context, orderID string, idToken map[string]any) error
 }
 }
 
 
 // CreateAccount mock.
 // CreateAccount mock.

+ 8 - 9
acme/db/nosql/eab.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"context"
 	"crypto/rand"
 	"crypto/rand"
 	"encoding/json"
 	"encoding/json"
+	"slices"
 	"sync"
 	"sync"
 	"time"
 	"time"
 
 
@@ -289,11 +290,9 @@ func (db *DB) addEAKID(ctx context.Context, provisionerID, eakID string) error {
 		}
 		}
 	}
 	}
 
 
-	for _, id := range eakIDs {
-		if id == eakID {
-			// return an error when a duplicate ID is found
-			return errors.Errorf("eakID %s already exists for provisioner %s", eakID, provisionerID)
-		}
+	if slices.Contains(eakIDs, eakID) {
+		// return an error when a duplicate ID is found
+		return errors.Errorf("eakID %s already exists for provisioner %s", eakID, provisionerID)
 	}
 	}
 
 
 	var newEAKIDs []string
 	var newEAKIDs []string
@@ -301,8 +300,8 @@ func (db *DB) addEAKID(ctx context.Context, provisionerID, eakID string) error {
 	newEAKIDs = append(newEAKIDs, eakID)
 	newEAKIDs = append(newEAKIDs, eakID)
 
 
 	var (
 	var (
-		_old interface{} = eakIDs
-		_new interface{} = newEAKIDs
+		_old any = eakIDs
+		_new any = newEAKIDs
 	)
 	)
 
 
 	// ensure that the DB gets the expected value when the slice is empty; otherwise
 	// ensure that the DB gets the expected value when the slice is empty; otherwise
@@ -338,8 +337,8 @@ func (db *DB) deleteEAKID(ctx context.Context, provisionerID, eakID string) erro
 
 
 	newEAKIDs := removeElement(eakIDs, eakID)
 	newEAKIDs := removeElement(eakIDs, eakID)
 	var (
 	var (
-		_old interface{} = eakIDs
-		_new interface{} = newEAKIDs
+		_old any = eakIDs
+		_new any = newEAKIDs
 	)
 	)
 
 
 	// ensure that the DB gets the expected value when the slice is empty; otherwise
 	// ensure that the DB gets the expected value when the slice is empty; otherwise

+ 1 - 1
acme/db/nosql/nosql.go

@@ -50,7 +50,7 @@ func New(db nosqlDB.DB) (*DB, error) {
 
 
 // save writes the new data to the database, overwriting the old data if it
 // save writes the new data to the database, overwriting the old data if it
 // existed.
 // existed.
-func (db *DB) save(_ context.Context, id string, nu, old interface{}, typ string, table []byte) error {
+func (db *DB) save(_ context.Context, id string, nu, old any, typ string, table []byte) error {
 	var (
 	var (
 		err  error
 		err  error
 		newB []byte
 		newB []byte

+ 2 - 2
acme/db/nosql/nosql_test.go

@@ -55,8 +55,8 @@ func (et errorThrower) MarshalJSON() ([]byte, error) {
 func TestDB_save(t *testing.T) {
 func TestDB_save(t *testing.T) {
 	type test struct {
 	type test struct {
 		db  nosql.DB
 		db  nosql.DB
-		nu  interface{}
-		old interface{}
+		nu  any
+		old any
 		err error
 		err error
 	}
 	}
 	var tests = map[string]test{
 	var tests = map[string]test{

+ 5 - 5
acme/db/nosql/order.go

@@ -21,10 +21,10 @@ type dbOrder struct {
 	Identifiers      []acme.Identifier `json:"identifiers"`
 	Identifiers      []acme.Identifier `json:"identifiers"`
 	AuthorizationIDs []string          `json:"authorizationIDs"`
 	AuthorizationIDs []string          `json:"authorizationIDs"`
 	Status           acme.Status       `json:"status"`
 	Status           acme.Status       `json:"status"`
-	NotBefore        time.Time         `json:"notBefore,omitempty"`
-	NotAfter         time.Time         `json:"notAfter,omitempty"`
+	NotBefore        time.Time         `json:"notBefore"`
+	NotAfter         time.Time         `json:"notAfter"`
 	CreatedAt        time.Time         `json:"createdAt"`
 	CreatedAt        time.Time         `json:"createdAt"`
-	ExpiresAt        time.Time         `json:"expiresAt,omitempty"`
+	ExpiresAt        time.Time         `json:"expiresAt"`
 	CertificateID    string            `json:"certificate,omitempty"`
 	CertificateID    string            `json:"certificate,omitempty"`
 	Error            *acme.Error       `json:"error,omitempty"`
 	Error            *acme.Error       `json:"error,omitempty"`
 }
 }
@@ -159,8 +159,8 @@ func (db *DB) updateAddOrderIDs(ctx context.Context, accID string, includeReadyO
 	}
 	}
 	pendOids = append(pendOids, addOids...)
 	pendOids = append(pendOids, addOids...)
 	var (
 	var (
-		_old interface{} = oldOids
-		_new interface{} = pendOids
+		_old any = oldOids
+		_new any = pendOids
 	)
 	)
 	switch {
 	switch {
 	case len(oldOids) == 0 && len(pendOids) == 0:
 	case len(oldOids) == 0 && len(pendOids) == 0:

+ 4 - 4
acme/errors_test.go

@@ -8,7 +8,7 @@ import (
 	"github.com/stretchr/testify/require"
 	"github.com/stretchr/testify/require"
 )
 )
 
 
-func mustJSON(t *testing.T, m map[string]interface{}) string {
+func mustJSON(t *testing.T, m map[string]any) string {
 	t.Helper()
 	t.Helper()
 
 
 	b, err := json.Marshal(m)
 	b, err := json.Marshal(m)
@@ -18,16 +18,16 @@ func mustJSON(t *testing.T, m map[string]interface{}) string {
 }
 }
 
 
 func TestError_WithAdditionalErrorDetail(t *testing.T) {
 func TestError_WithAdditionalErrorDetail(t *testing.T) {
-	internalJSON := mustJSON(t, map[string]interface{}{
+	internalJSON := mustJSON(t, map[string]any{
 		"detail": "The server experienced an internal error",
 		"detail": "The server experienced an internal error",
 		"type":   "urn:ietf:params:acme:error:serverInternal",
 		"type":   "urn:ietf:params:acme:error:serverInternal",
 	})
 	})
 	malformedErr := NewError(ErrorMalformedType, "malformed error") // will result in Err == nil behavior
 	malformedErr := NewError(ErrorMalformedType, "malformed error") // will result in Err == nil behavior
-	malformedJSON := mustJSON(t, map[string]interface{}{
+	malformedJSON := mustJSON(t, map[string]any{
 		"detail": "The request message was malformed",
 		"detail": "The request message was malformed",
 		"type":   "urn:ietf:params:acme:error:malformed",
 		"type":   "urn:ietf:params:acme:error:malformed",
 	})
 	})
-	withDetailJSON := mustJSON(t, map[string]interface{}{
+	withDetailJSON := mustJSON(t, map[string]any{
 		"detail": "Attestation statement cannot be verified: invalid property",
 		"detail": "Attestation statement cannot be verified: invalid property",
 		"type":   "urn:ietf:params:acme:error:badAttestationStatement",
 		"type":   "urn:ietf:params:acme:error:badAttestationStatement",
 	})
 	})

+ 2 - 3
acme/order.go

@@ -64,7 +64,7 @@ type Order struct {
 }
 }
 
 
 // ToLog enables response logging.
 // ToLog enables response logging.
-func (o *Order) ToLog() (interface{}, error) {
+func (o *Order) ToLog() (any, error) {
 	b, err := json.Marshal(o)
 	b, err := json.Marshal(o)
 	if err != nil {
 	if err != nil {
 		return nil, WrapErrorISE(err, "error marshaling order for logging")
 		return nil, WrapErrorISE(err, "error marshaling order for logging")
@@ -307,8 +307,7 @@ func (o *Order) Finalize(ctx context.Context, db DB, csr *x509.CertificateReques
 	}, signOps...)
 	}, signOps...)
 	if err != nil {
 	if err != nil {
 		// Add subproblem for webhook errors, others can be added later.
 		// Add subproblem for webhook errors, others can be added later.
-		var webhookErr *webhook.Error
-		if errors.As(err, &webhookErr) {
+		if webhookErr, ok := errors.AsType[*webhook.Error](err); ok {
 			acmeError := NewDetailedError(ErrorUnauthorizedType, "%s", webhookErr.Error())
 			acmeError := NewDetailedError(ErrorUnauthorizedType, "%s", webhookErr.Error())
 			acmeError.AddSubproblems(Subproblem{
 			acmeError.AddSubproblems(Subproblem{
 				Type:   fmt.Sprintf("urn:smallstep:acme:error:%s", webhookErr.Code),
 				Type:   fmt.Sprintf("urn:smallstep:acme:error:%s", webhookErr.Code),

+ 17 - 17
acme/order_test.go

@@ -276,7 +276,7 @@ type mockSignAuth struct {
 	signWithContext       func(ctx context.Context, csr *x509.CertificateRequest, signOpts provisioner.SignOptions, extraOpts ...provisioner.SignOption) ([]*x509.Certificate, error)
 	signWithContext       func(ctx context.Context, csr *x509.CertificateRequest, signOpts provisioner.SignOptions, extraOpts ...provisioner.SignOption) ([]*x509.Certificate, error)
 	areSANsAllowed        func(ctx context.Context, sans []string) error
 	areSANsAllowed        func(ctx context.Context, sans []string) error
 	loadProvisionerByName func(string) (provisioner.Interface, error)
 	loadProvisionerByName func(string) (provisioner.Interface, error)
-	ret1, ret2            interface{}
+	ret1, ret2            any
 	err                   error
 	err                   error
 }
 }
 
 
@@ -1133,16 +1133,16 @@ func TestOrder_Finalize(t *testing.T) {
 							return &Authorization{ID: id, Status: StatusValid}, nil
 							return &Authorization{ID: id, Status: StatusValid}, nil
 						},
 						},
 					},
 					},
-					MockGetDpopToken: func(ctx context.Context, orderID string) (map[string]interface{}, error) {
+					MockGetDpopToken: func(ctx context.Context, orderID string) (map[string]any, error) {
 						assert.Equals(t, orderID, o.ID)
 						assert.Equals(t, orderID, o.ID)
-						dpopMap := map[string]interface{}{
+						dpopMap := map[string]any{
 							"dpop": "a-dpop-token",
 							"dpop": "a-dpop-token",
 						}
 						}
 						return dpopMap, nil
 						return dpopMap, nil
 					},
 					},
-					MockGetOidcToken: func(ctx context.Context, orderID string) (map[string]interface{}, error) {
+					MockGetOidcToken: func(ctx context.Context, orderID string) (map[string]any, error) {
 						assert.Equals(t, orderID, o.ID)
 						assert.Equals(t, orderID, o.ID)
-						oidcMap := map[string]interface{}{
+						oidcMap := map[string]any{
 							"oidc": "a-oidc-token",
 							"oidc": "a-oidc-token",
 						}
 						}
 						return oidcMap, nil
 						return oidcMap, nil
@@ -1226,16 +1226,16 @@ func TestOrder_Finalize(t *testing.T) {
 							return &Authorization{ID: id, Status: StatusValid}, nil
 							return &Authorization{ID: id, Status: StatusValid}, nil
 						},
 						},
 					},
 					},
-					MockGetDpopToken: func(ctx context.Context, orderID string) (map[string]interface{}, error) {
+					MockGetDpopToken: func(ctx context.Context, orderID string) (map[string]any, error) {
 						assert.Equals(t, orderID, o.ID)
 						assert.Equals(t, orderID, o.ID)
-						dpopMap := map[string]interface{}{
+						dpopMap := map[string]any{
 							"dpop": "a-dpop-token",
 							"dpop": "a-dpop-token",
 						}
 						}
 						return dpopMap, nil
 						return dpopMap, nil
 					},
 					},
-					MockGetOidcToken: func(ctx context.Context, orderID string) (map[string]interface{}, error) {
+					MockGetOidcToken: func(ctx context.Context, orderID string) (map[string]any, error) {
 						assert.Equals(t, orderID, o.ID)
 						assert.Equals(t, orderID, o.ID)
-						oidcMap := map[string]interface{}{
+						oidcMap := map[string]any{
 							"oidc": "a-oidc-token",
 							"oidc": "a-oidc-token",
 						}
 						}
 						return oidcMap, nil
 						return oidcMap, nil
@@ -1614,16 +1614,16 @@ func TestOrder_Finalize(t *testing.T) {
 							return &Authorization{ID: id, Status: StatusValid}, nil
 							return &Authorization{ID: id, Status: StatusValid}, nil
 						},
 						},
 					},
 					},
-					MockGetDpopToken: func(ctx context.Context, orderID string) (map[string]interface{}, error) {
+					MockGetDpopToken: func(ctx context.Context, orderID string) (map[string]any, error) {
 						assert.Equals(t, orderID, o.ID)
 						assert.Equals(t, orderID, o.ID)
-						dpopMap := map[string]interface{}{
+						dpopMap := map[string]any{
 							"dpop": "a-dpop-token",
 							"dpop": "a-dpop-token",
 						}
 						}
 						return dpopMap, nil
 						return dpopMap, nil
 					},
 					},
-					MockGetOidcToken: func(ctx context.Context, orderID string) (map[string]interface{}, error) {
+					MockGetOidcToken: func(ctx context.Context, orderID string) (map[string]any, error) {
 						assert.Equals(t, orderID, o.ID)
 						assert.Equals(t, orderID, o.ID)
-						oidcMap := map[string]interface{}{
+						oidcMap := map[string]any{
 							"oidc": "a-oidc-token",
 							"oidc": "a-oidc-token",
 						}
 						}
 						return oidcMap, nil
 						return oidcMap, nil
@@ -1706,16 +1706,16 @@ func TestOrder_Finalize(t *testing.T) {
 							return &Authorization{ID: id, Status: StatusValid}, nil
 							return &Authorization{ID: id, Status: StatusValid}, nil
 						},
 						},
 					},
 					},
-					MockGetDpopToken: func(ctx context.Context, orderID string) (map[string]interface{}, error) {
+					MockGetDpopToken: func(ctx context.Context, orderID string) (map[string]any, error) {
 						assert.Equals(t, orderID, o.ID)
 						assert.Equals(t, orderID, o.ID)
-						dpopMap := map[string]interface{}{
+						dpopMap := map[string]any{
 							"dpop": "a-dpop-token",
 							"dpop": "a-dpop-token",
 						}
 						}
 						return dpopMap, nil
 						return dpopMap, nil
 					},
 					},
-					MockGetOidcToken: func(ctx context.Context, orderID string) (map[string]interface{}, error) {
+					MockGetOidcToken: func(ctx context.Context, orderID string) (map[string]any, error) {
 						assert.Equals(t, orderID, o.ID)
 						assert.Equals(t, orderID, o.ID)
-						oidcMap := map[string]interface{}{
+						oidcMap := map[string]any{
 							"oidc": "a-oidc-token",
 							"oidc": "a-oidc-token",
 						}
 						}
 						return oidcMap, nil
 						return oidcMap, nil

+ 6 - 3
api/api.go

@@ -21,6 +21,7 @@ import (
 
 
 	"github.com/go-chi/chi/v5"
 	"github.com/go-chi/chi/v5"
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
+	"go.step.sm/crypto/mldsa"
 	"go.step.sm/crypto/sshutil"
 	"go.step.sm/crypto/sshutil"
 	"golang.org/x/crypto/ssh"
 	"golang.org/x/crypto/ssh"
 
 
@@ -539,7 +540,7 @@ type stepProvisioner struct {
 
 
 func logOtt(w http.ResponseWriter, token string) {
 func logOtt(w http.ResponseWriter, token string) {
 	if rl, ok := w.(logging.ResponseLogger); ok {
 	if rl, ok := w.(logging.ResponseLogger); ok {
-		rl.WithFields(map[string]interface{}{
+		rl.WithFields(map[string]any{
 			"ott": token,
 			"ott": token,
 		})
 		})
 	}
 	}
@@ -548,7 +549,7 @@ func logOtt(w http.ResponseWriter, token string) {
 // LogCertificate adds certificate fields to the log message.
 // LogCertificate adds certificate fields to the log message.
 func LogCertificate(w http.ResponseWriter, cert *x509.Certificate) {
 func LogCertificate(w http.ResponseWriter, cert *x509.Certificate) {
 	if rl, ok := w.(logging.ResponseLogger); ok {
 	if rl, ok := w.(logging.ResponseLogger); ok {
-		m := map[string]interface{}{
+		m := map[string]any{
 			"serial":      cert.SerialNumber.String(),
 			"serial":      cert.SerialNumber.String(),
 			"subject":     cert.Subject.CommonName,
 			"subject":     cert.Subject.CommonName,
 			"issuer":      cert.Issuer.CommonName,
 			"issuer":      cert.Issuer.CommonName,
@@ -594,7 +595,7 @@ func LogSSHCertificate(w http.ResponseWriter, cert *ssh.Certificate) {
 			userOrHost = "user"
 			userOrHost = "user"
 		}
 		}
 		certificateType := fmt.Sprintf("%s %s certificate", parts[0], userOrHost) // e.g. ecdsa-sha2-nistp256-cert-v01@openssh.com user certificate
 		certificateType := fmt.Sprintf("%s %s certificate", parts[0], userOrHost) // e.g. ecdsa-sha2-nistp256-cert-v01@openssh.com user certificate
-		m := map[string]interface{}{
+		m := map[string]any{
 			"serial":           cert.Serial,
 			"serial":           cert.Serial,
 			"principals":       cert.ValidPrincipals,
 			"principals":       cert.ValidPrincipals,
 			"valid-from":       time.Unix(cast.Int64(cert.ValidAfter), 0).Format(time.RFC3339),
 			"valid-from":       time.Unix(cast.Int64(cert.ValidAfter), 0).Format(time.RFC3339),
@@ -660,6 +661,8 @@ func fmtPublicKey(cert *x509.Certificate) string {
 		params = strconv.Itoa(pk.Size() * 8)
 		params = strconv.Itoa(pk.Size() * 8)
 	case ed25519.PublicKey:
 	case ed25519.PublicKey:
 		return cert.PublicKeyAlgorithm.String()
 		return cert.PublicKeyAlgorithm.String()
+	case *mldsa.PublicKey:
+		return pk.Parameters().String()
 	case *dsa.PublicKey:
 	case *dsa.PublicKey:
 		params = strconv.Itoa(pk.Q.BitLen() * 8)
 		params = strconv.Itoa(pk.Q.BitLen() * 8)
 	default:
 	default:

+ 4 - 4
api/api_test.go

@@ -191,7 +191,7 @@ func mockMustAuthority(t *testing.T, a Authority) {
 }
 }
 
 
 type mockAuthority struct {
 type mockAuthority struct {
-	ret1, ret2                   interface{}
+	ret1, ret2                   any
 	err                          error
 	err                          error
 	authorize                    func(ctx context.Context, ott string) ([]provisioner.SignOption, error)
 	authorize                    func(ctx context.Context, ott string) ([]provisioner.SignOption, error)
 	authorizeRenewToken          func(ctx context.Context, ott string) (*x509.Certificate, error)
 	authorizeRenewToken          func(ctx context.Context, ott string) (*x509.Certificate, error)
@@ -681,7 +681,7 @@ func TestSignRequest_Validate(t *testing.T) {
 }
 }
 
 
 type mockProvisioner struct {
 type mockProvisioner struct {
-	ret1, ret2, ret3   interface{}
+	ret1, ret2, ret3   any
 	err                error
 	err                error
 	getID              func() string
 	getID              func() string
 	getIDForToken      func() string
 	getIDForToken      func() string
@@ -1487,7 +1487,7 @@ func Test_fmtPublicKey(t *testing.T) {
 	}
 	}
 
 
 	type args struct {
 	type args struct {
-		pub, priv interface{}
+		pub, priv any
 		cert      *x509.Certificate
 		cert      *x509.Certificate
 	}
 	}
 	tests := []struct {
 	tests := []struct {
@@ -1516,7 +1516,7 @@ func Test_fmtPublicKey(t *testing.T) {
 	}
 	}
 }
 }
 
 
-func mustCertificate(t *testing.T, pub, priv interface{}) *x509.Certificate {
+func mustCertificate(t *testing.T, pub, priv any) *x509.Certificate {
 	template := x509.Certificate{
 	template := x509.Certificate{
 		SerialNumber: big.NewInt(1),
 		SerialNumber: big.NewInt(1),
 		Subject: pkix.Name{
 		Subject: pkix.Name{

+ 1 - 1
api/read/read.go

@@ -17,7 +17,7 @@ import (
 
 
 // JSON reads JSON from the request body and stores it in the value
 // JSON reads JSON from the request body and stores it in the value
 // pointed to by v.
 // pointed to by v.
-func JSON(r io.Reader, v interface{}) error {
+func JSON(r io.Reader, v any) error {
 	if err := json.NewDecoder(r).Decode(v); err != nil {
 	if err := json.NewDecoder(r).Decode(v); err != nil {
 		return errs.BadRequestErr(err, "error decoding json")
 		return errs.BadRequestErr(err, "error decoding json")
 	}
 	}

+ 6 - 7
api/read/read_test.go

@@ -23,15 +23,15 @@ import (
 func TestJSON(t *testing.T) {
 func TestJSON(t *testing.T) {
 	type args struct {
 	type args struct {
 		r io.Reader
 		r io.Reader
-		v interface{}
+		v any
 	}
 	}
 	tests := []struct {
 	tests := []struct {
 		name    string
 		name    string
 		args    args
 		args    args
 		wantErr bool
 		wantErr bool
 	}{
 	}{
-		{"ok", args{strings.NewReader(`{"foo":"bar"}`), make(map[string]interface{})}, false},
-		{"fail", args{strings.NewReader(`{"foo"}`), make(map[string]interface{})}, true},
+		{"ok", args{strings.NewReader(`{"foo":"bar"}`), make(map[string]any)}, false},
+		{"fail", args{strings.NewReader(`{"foo"}`), make(map[string]any)}, true},
 	}
 	}
 	for _, tt := range tests {
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 		t.Run(tt.name, func(t *testing.T) {
@@ -41,16 +41,15 @@ func TestJSON(t *testing.T) {
 			}
 			}
 
 
 			if tt.wantErr {
 			if tt.wantErr {
-				var e *errs.Error
-				if errors.As(err, &e) {
+				if e, ok := errors.AsType[*errs.Error](err); ok {
 					if code := e.StatusCode(); code != 400 {
 					if code := e.StatusCode(); code != 400 {
 						t.Errorf("error.StatusCode() = %v, wants 400", code)
 						t.Errorf("error.StatusCode() = %v, wants 400", code)
 					}
 					}
 				} else {
 				} else {
 					t.Errorf("error type = %T, wants *Error", err)
 					t.Errorf("error type = %T, wants *Error", err)
 				}
 				}
-			} else if !reflect.DeepEqual(tt.args.v, map[string]interface{}{"foo": "bar"}) {
-				t.Errorf("JSON value = %v, wants %v", tt.args.v, map[string]interface{}{"foo": "bar"})
+			} else if !reflect.DeepEqual(tt.args.v, map[string]any{"foo": "bar"}) {
+				t.Errorf("JSON value = %v, wants %v", tt.args.v, map[string]any{"foo": "bar"})
 			}
 			}
 		})
 		})
 	}
 	}

+ 7 - 12
api/render/render.go

@@ -13,7 +13,7 @@ import (
 )
 )
 
 
 // JSON is shorthand for JSONStatus(w, v, http.StatusOK).
 // JSON is shorthand for JSONStatus(w, v, http.StatusOK).
-func JSON(w http.ResponseWriter, r *http.Request, v interface{}) {
+func JSON(w http.ResponseWriter, r *http.Request, v any) {
 	JSONStatus(w, r, v, http.StatusOK)
 	JSONStatus(w, r, v, http.StatusOK)
 }
 }
 
 
@@ -22,23 +22,20 @@ func JSON(w http.ResponseWriter, r *http.Request, v interface{}) {
 //
 //
 // JSONStatus sets the Content-Type of w to application/json unless one is
 // JSONStatus sets the Content-Type of w to application/json unless one is
 // specified.
 // specified.
-func JSONStatus(w http.ResponseWriter, r *http.Request, v interface{}, status int) {
+func JSONStatus(w http.ResponseWriter, r *http.Request, v any, status int) {
 	setContentTypeUnlessPresent(w, "application/json")
 	setContentTypeUnlessPresent(w, "application/json")
 	w.WriteHeader(status)
 	w.WriteHeader(status)
 
 
 	if err := json.NewEncoder(w).Encode(v); err != nil {
 	if err := json.NewEncoder(w).Encode(v); err != nil {
-		var errUnsupportedType *json.UnsupportedTypeError
-		if errors.As(err, &errUnsupportedType) {
+		if _, ok := errors.AsType[*json.UnsupportedTypeError](err); ok {
 			panic(err)
 			panic(err)
 		}
 		}
 
 
-		var errUnsupportedValue *json.UnsupportedValueError
-		if errors.As(err, &errUnsupportedValue) {
+		if _, ok := errors.AsType[*json.UnsupportedValueError](err); ok {
 			panic(err)
 			panic(err)
 		}
 		}
 
 
-		var errMarshalError *json.MarshalerError
-		if errors.As(err, &errMarshalError) {
+		if _, ok := errors.AsType[*json.MarshalerError](err); ok {
 			panic(err)
 			panic(err)
 		}
 		}
 	}
 	}
@@ -88,8 +85,7 @@ type RenderableError interface {
 func Error(rw http.ResponseWriter, r *http.Request, err error) {
 func Error(rw http.ResponseWriter, r *http.Request, err error) {
 	log.Error(rw, r, err)
 	log.Error(rw, r, err)
 
 
-	var re RenderableError
-	if errors.As(err, &re) {
+	if re, ok := errors.AsType[RenderableError](err); ok {
 		re.Render(rw, r)
 		re.Render(rw, r)
 
 
 		return
 		return
@@ -117,8 +113,7 @@ func statusCodeFromError(err error) (code int) {
 	}
 	}
 
 
 	for err != nil {
 	for err != nil {
-		var sc StatusCodedError
-		if errors.As(err, &sc) {
+		if sc, ok := errors.AsType[StatusCodedError](err); ok {
 			code = sc.StatusCode()
 			code = sc.StatusCode()
 
 
 			break
 			break

+ 1 - 1
api/render/render_test.go

@@ -19,7 +19,7 @@ func TestJSON(t *testing.T) {
 	rec := httptest.NewRecorder()
 	rec := httptest.NewRecorder()
 	rw := logging.NewResponseLogger(rec)
 	rw := logging.NewResponseLogger(rec)
 	r := httptest.NewRequest("POST", "/test", http.NoBody)
 	r := httptest.NewRequest("POST", "/test", http.NoBody)
-	JSON(rw, r, map[string]interface{}{"foo": "bar"})
+	JSON(rw, r, map[string]any{"foo": "bar"})
 
 
 	assert.Equal(t, http.StatusOK, rec.Result().StatusCode)
 	assert.Equal(t, http.StatusOK, rec.Result().StatusCode)
 	assert.Equal(t, "application/json", rec.Header().Get("Content-Type"))
 	assert.Equal(t, "application/json", rec.Header().Get("Content-Type"))

+ 1 - 1
api/revoke.go

@@ -117,7 +117,7 @@ func Revoke(w http.ResponseWriter, r *http.Request) {
 
 
 func logRevoke(w http.ResponseWriter, ri *authority.RevokeOptions) {
 func logRevoke(w http.ResponseWriter, ri *authority.RevokeOptions) {
 	if rl, ok := w.(logging.ResponseLogger); ok {
 	if rl, ok := w.(logging.ResponseLogger); ok {
-		rl.WithFields(map[string]interface{}{
+		rl.WithFields(map[string]any{
 			"serial":      ri.Serial,
 			"serial":      ri.Serial,
 			"reasonCode":  ri.ReasonCode,
 			"reasonCode":  ri.ReasonCode,
 			"reason":      ri.Reason,
 			"reason":      ri.Reason,

+ 2 - 2
api/sign.go

@@ -16,8 +16,8 @@ import (
 type SignRequest struct {
 type SignRequest struct {
 	CsrPEM       CertificateRequest `json:"csr"`
 	CsrPEM       CertificateRequest `json:"csr"`
 	OTT          string             `json:"ott"`
 	OTT          string             `json:"ott"`
-	NotAfter     TimeDuration       `json:"notAfter,omitempty"`
-	NotBefore    TimeDuration       `json:"notBefore,omitempty"`
+	NotAfter     TimeDuration       `json:"notAfter"`
+	NotBefore    TimeDuration       `json:"notBefore"`
 	TemplateData json.RawMessage    `json:"templateData,omitempty"`
 	TemplateData json.RawMessage    `json:"templateData,omitempty"`
 }
 }
 
 

+ 3 - 3
api/ssh.go

@@ -45,10 +45,10 @@ type SSHSignRequest struct {
 	CertType         string             `json:"certType,omitempty"`
 	CertType         string             `json:"certType,omitempty"`
 	KeyID            string             `json:"keyID,omitempty"`
 	KeyID            string             `json:"keyID,omitempty"`
 	Principals       []string           `json:"principals,omitempty"`
 	Principals       []string           `json:"principals,omitempty"`
-	ValidAfter       TimeDuration       `json:"validAfter,omitempty"`
-	ValidBefore      TimeDuration       `json:"validBefore,omitempty"`
+	ValidAfter       TimeDuration       `json:"validAfter"`
+	ValidBefore      TimeDuration       `json:"validBefore"`
 	AddUserPublicKey []byte             `json:"addUserPublicKey,omitempty"`
 	AddUserPublicKey []byte             `json:"addUserPublicKey,omitempty"`
-	IdentityCSR      CertificateRequest `json:"identityCSR,omitempty"`
+	IdentityCSR      CertificateRequest `json:"identityCSR"`
 	TemplateData     json.RawMessage    `json:"templateData,omitempty"`
 	TemplateData     json.RawMessage    `json:"templateData,omitempty"`
 }
 }
 
 

+ 1 - 1
api/sshRevoke.go

@@ -90,7 +90,7 @@ func SSHRevoke(w http.ResponseWriter, r *http.Request) {
 
 
 func logSSHRevoke(w http.ResponseWriter, ri *authority.RevokeOptions) {
 func logSSHRevoke(w http.ResponseWriter, ri *authority.RevokeOptions) {
 	if rl, ok := w.(logging.ResponseLogger); ok {
 	if rl, ok := w.(logging.ResponseLogger); ok {
-		rl.WithFields(map[string]interface{}{
+		rl.WithFields(map[string]any{
 			"serial":      ri.Serial,
 			"serial":      ri.Serial,
 			"reasonCode":  ri.ReasonCode,
 			"reasonCode":  ri.ReasonCode,
 			"reason":      ri.Reason,
 			"reason":      ri.Reason,

+ 1 - 1
authority/admin/api/admin_test.go

@@ -26,7 +26,7 @@ import (
 type mockAdminAuthority struct {
 type mockAdminAuthority struct {
 	MockLoadProvisionerByName func(name string) (provisioner.Interface, error)
 	MockLoadProvisionerByName func(name string) (provisioner.Interface, error)
 	MockGetProvisioners       func(nextCursor string, limit int) (provisioner.List, string, error)
 	MockGetProvisioners       func(nextCursor string, limit int) (provisioner.List, string, error)
-	MockRet1, MockRet2        interface{} // TODO: refactor the ret1/ret2 into those two
+	MockRet1, MockRet2        any // TODO: refactor the ret1/ret2 into those two
 	MockErr                   error
 	MockErr                   error
 	MockIsAdminAPIEnabled     func() bool
 	MockIsAdminAPIEnabled     func() bool
 	MockLoadAdminByID         func(id string) (*linkedca.Admin, bool)
 	MockLoadAdminByID         func(id string) (*linkedca.Admin, bool)

+ 1 - 1
authority/admin/db.go

@@ -123,7 +123,7 @@ type MockDB struct {
 	MockDeleteAuthorityPolicy func(ctx context.Context) error
 	MockDeleteAuthorityPolicy func(ctx context.Context) error
 
 
 	MockError error
 	MockError error
-	MockRet1  interface{}
+	MockRet1  any
 }
 }
 
 
 // CreateProvisioner mock.
 // CreateProvisioner mock.

+ 1 - 1
authority/admin/db/nosql/nosql.go

@@ -36,7 +36,7 @@ func New(db nosqlDB.DB, authorityID string) (*DB, error) {
 
 
 // save writes the new data to the database, overwriting the old data if it
 // save writes the new data to the database, overwriting the old data if it
 // existed.
 // existed.
-func (db *DB) save(_ context.Context, id string, nu, old interface{}, typ string, table []byte) error {
+func (db *DB) save(_ context.Context, id string, nu, old any, typ string, table []byte) error {
 	var (
 	var (
 		err  error
 		err  error
 		newB []byte
 		newB []byte

+ 6 - 12
authority/admin/db/nosql/policy_test.go

@@ -72,8 +72,7 @@ func TestDB_getDBAuthorityPolicyBytes(t *testing.T) {
 		t.Run(name, func(t *testing.T) {
 		t.Run(name, func(t *testing.T) {
 			d := DB{db: tc.db}
 			d := DB{db: tc.db}
 			if b, err := d.getDBAuthorityPolicyBytes(tc.ctx, tc.authorityID); err != nil {
 			if b, err := d.getDBAuthorityPolicyBytes(tc.ctx, tc.authorityID); err != nil {
-				var ae *admin.Error
-				if errors.As(err, &ae) {
+				if ae, ok := errors.AsType[*admin.Error](err); ok {
 					if assert.NotNil(t, tc.adminErr) {
 					if assert.NotNil(t, tc.adminErr) {
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
@@ -208,8 +207,7 @@ func TestDB_getDBAuthorityPolicy(t *testing.T) {
 			dbp, err := d.getDBAuthorityPolicy(tc.ctx, tc.authorityID)
 			dbp, err := d.getDBAuthorityPolicy(tc.ctx, tc.authorityID)
 			switch {
 			switch {
 			case err != nil:
 			case err != nil:
-				var ae *admin.Error
-				if errors.As(err, &ae) {
+				if ae, ok := errors.AsType[*admin.Error](err); ok {
 					if assert.NotNil(t, tc.adminErr) {
 					if assert.NotNil(t, tc.adminErr) {
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
@@ -309,8 +307,7 @@ func TestDB_CreateAuthorityPolicy(t *testing.T) {
 		t.Run(name, func(t *testing.T) {
 		t.Run(name, func(t *testing.T) {
 			d := DB{db: tc.db, authorityID: tc.authorityID}
 			d := DB{db: tc.db, authorityID: tc.authorityID}
 			if err := d.CreateAuthorityPolicy(tc.ctx, tc.policy); err != nil {
 			if err := d.CreateAuthorityPolicy(tc.ctx, tc.policy); err != nil {
-				var ae *admin.Error
-				if errors.As(err, &ae) {
+				if ae, ok := errors.AsType[*admin.Error](err); ok {
 					if assert.NotNil(t, tc.adminErr) {
 					if assert.NotNil(t, tc.adminErr) {
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
@@ -406,8 +403,7 @@ func TestDB_GetAuthorityPolicy(t *testing.T) {
 			d := DB{db: tc.db, authorityID: tc.authorityID}
 			d := DB{db: tc.db, authorityID: tc.authorityID}
 			got, err := d.GetAuthorityPolicy(tc.ctx)
 			got, err := d.GetAuthorityPolicy(tc.ctx)
 			if err != nil {
 			if err != nil {
-				var ae *admin.Error
-				if errors.As(err, &ae) {
+				if ae, ok := errors.AsType[*admin.Error](err); ok {
 					if assert.NotNil(t, tc.adminErr) {
 					if assert.NotNil(t, tc.adminErr) {
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
@@ -578,8 +574,7 @@ func TestDB_UpdateAuthorityPolicy(t *testing.T) {
 		t.Run(name, func(t *testing.T) {
 		t.Run(name, func(t *testing.T) {
 			d := DB{db: tc.db, authorityID: tc.authorityID}
 			d := DB{db: tc.db, authorityID: tc.authorityID}
 			if err := d.UpdateAuthorityPolicy(tc.ctx, tc.policy); err != nil {
 			if err := d.UpdateAuthorityPolicy(tc.ctx, tc.policy); err != nil {
-				var ae *admin.Error
-				if errors.As(err, &ae) {
+				if ae, ok := errors.AsType[*admin.Error](err); ok {
 					if assert.NotNil(t, tc.adminErr) {
 					if assert.NotNil(t, tc.adminErr) {
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
@@ -718,8 +713,7 @@ func TestDB_DeleteAuthorityPolicy(t *testing.T) {
 		t.Run(name, func(t *testing.T) {
 		t.Run(name, func(t *testing.T) {
 			d := DB{db: tc.db, authorityID: tc.authorityID}
 			d := DB{db: tc.db, authorityID: tc.authorityID}
 			if err := d.DeleteAuthorityPolicy(tc.ctx); err != nil {
 			if err := d.DeleteAuthorityPolicy(tc.ctx); err != nil {
-				var ae *admin.Error
-				if errors.As(err, &ae) {
+				if ae, ok := errors.AsType[*admin.Error](err); ok {
 					if assert.NotNil(t, tc.adminErr) {
 					if assert.NotNil(t, tc.adminErr) {
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Type, tc.adminErr.Type)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)
 						assert.Equals(t, ae.Detail, tc.adminErr.Detail)

+ 5 - 5
authority/admin/errors.go

@@ -125,7 +125,7 @@ func (e *Error) IsType(pt ProblemType) bool {
 }
 }
 
 
 // NewError creates a new Error type.
 // NewError creates a new Error type.
-func NewError(pt ProblemType, msg string, args ...interface{}) *Error {
+func NewError(pt ProblemType, msg string, args ...any) *Error {
 	return newError(pt, errors.Errorf(msg, args...))
 	return newError(pt, errors.Errorf(msg, args...))
 }
 }
 
 
@@ -150,12 +150,12 @@ func newError(pt ProblemType, err error) *Error {
 }
 }
 
 
 // NewErrorISE creates a new ErrorServerInternalType Error.
 // NewErrorISE creates a new ErrorServerInternalType Error.
-func NewErrorISE(msg string, args ...interface{}) *Error {
+func NewErrorISE(msg string, args ...any) *Error {
 	return NewError(ErrorServerInternalType, msg, args...)
 	return NewError(ErrorServerInternalType, msg, args...)
 }
 }
 
 
 // WrapError attempts to wrap the internal error.
 // WrapError attempts to wrap the internal error.
-func WrapError(typ ProblemType, err error, msg string, args ...interface{}) *Error {
+func WrapError(typ ProblemType, err error, msg string, args ...any) *Error {
 	var ee *Error
 	var ee *Error
 	switch {
 	switch {
 	case err == nil:
 	case err == nil:
@@ -173,7 +173,7 @@ func WrapError(typ ProblemType, err error, msg string, args ...interface{}) *Err
 }
 }
 
 
 // WrapErrorISE shortcut to wrap an internal server error type.
 // WrapErrorISE shortcut to wrap an internal server error type.
-func WrapErrorISE(err error, msg string, args ...interface{}) *Error {
+func WrapErrorISE(err error, msg string, args ...any) *Error {
 	return WrapError(ErrorServerInternalType, err, msg, args...)
 	return WrapError(ErrorServerInternalType, err, msg, args...)
 }
 }
 
 
@@ -196,7 +196,7 @@ func (e *Error) Cause() error {
 }
 }
 
 
 // ToLog implements the EnableLogger interface.
 // ToLog implements the EnableLogger interface.
-func (e *Error) ToLog() (interface{}, error) {
+func (e *Error) ToLog() (any, error) {
 	b, err := json.Marshal(e)
 	b, err := json.Marshal(e)
 	if err != nil {
 	if err != nil {
 		return nil, WrapErrorISE(err, "error marshaling authority.Error for logging")
 		return nil, WrapErrorISE(err, "error marshaling authority.Error for logging")

+ 1 - 1
authority/administrator/collection.go

@@ -230,7 +230,7 @@ func (c *Collection) Find(cursor string, limit int) ([]*linkedca.Admin, string)
 	return slice, ""
 	return slice, ""
 }
 }
 
 
-func loadAdmin(m *sync.Map, key interface{}) (*linkedca.Admin, bool) {
+func loadAdmin(m *sync.Map, key any) (*linkedca.Admin, bool) {
 	val, ok := m.Load(key)
 	val, ok := m.Load(key)
 	if !ok {
 	if !ok {
 		return nil, false
 		return nil, false

+ 1 - 1
authority/authority.go

@@ -843,7 +843,7 @@ func (a *Authority) init() error {
 			a.templates = templates.DefaultTemplates()
 			a.templates = templates.DefaultTemplates()
 		}
 		}
 		if a.templates.Data == nil {
 		if a.templates.Data == nil {
-			a.templates.Data = make(map[string]interface{})
+			a.templates.Data = make(map[string]any)
 		}
 		}
 		a.templates.Data["Step"] = tmplVars
 		a.templates.Data["Step"] = tmplVars
 	}
 	}

+ 3 - 3
authority/authorize.go

@@ -228,7 +228,7 @@ func (a *Authority) UseToken(ctx context.Context, token string, prov provisioner
 // Authorize grabs the method from the context and authorizes the request by
 // Authorize grabs the method from the context and authorizes the request by
 // validating the one-time-token.
 // validating the one-time-token.
 func (a *Authority) Authorize(ctx context.Context, token string) ([]provisioner.SignOption, error) {
 func (a *Authority) Authorize(ctx context.Context, token string) ([]provisioner.SignOption, error) {
-	var opts = []interface{}{errs.WithKeyVal("token", token)}
+	var opts = []any{errs.WithKeyVal("token", token)}
 
 
 	switch m := provisioner.MethodFromContext(ctx); m {
 	switch m := provisioner.MethodFromContext(ctx); m {
 	case provisioner.SignMethod, provisioner.SignIdentityMethod:
 	case provisioner.SignMethod, provisioner.SignIdentityMethod:
@@ -257,7 +257,7 @@ func (a *Authority) Authorize(ctx context.Context, token string) ([]provisioner.
 		_, signOpts, err := a.authorizeSSHRekey(ctx, token)
 		_, signOpts, err := a.authorizeSSHRekey(ctx, token)
 		return signOpts, errs.Wrap(http.StatusInternalServerError, err, "authority.Authorize", opts...)
 		return signOpts, errs.Wrap(http.StatusInternalServerError, err, "authority.Authorize", opts...)
 	default:
 	default:
-		return nil, errs.InternalServer("authority.Authorize; method %d is not supported", append([]interface{}{m}, opts...)...)
+		return nil, errs.InternalServer("authority.Authorize; method %d is not supported", append([]any{m}, opts...)...)
 	}
 	}
 }
 }
 
 
@@ -305,7 +305,7 @@ func (a *Authority) authorizeRevoke(ctx context.Context, token string) error {
 // TODO(mariano): should we authorize by default?
 // TODO(mariano): should we authorize by default?
 func (a *Authority) authorizeRenew(ctx context.Context, cert *x509.Certificate) (provisioner.Interface, error) {
 func (a *Authority) authorizeRenew(ctx context.Context, cert *x509.Certificate) (provisioner.Interface, error) {
 	serial := cert.SerialNumber.String()
 	serial := cert.SerialNumber.String()
-	var opts = []interface{}{errs.WithKeyVal("serialNumber", serial)}
+	var opts = []any{errs.WithKeyVal("serialNumber", serial)}
 
 
 	isRevoked, err := a.IsRevoked(serial)
 	isRevoked, err := a.IsRevoked(serial)
 	if err != nil {
 	if err != nil {

+ 2 - 6
authority/config/types.go

@@ -2,6 +2,7 @@ package config
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"
+	"slices"
 
 
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
 )
 )
@@ -24,12 +25,7 @@ func (s multiString) HasEmpties() bool {
 	if len(s) == 0 {
 	if len(s) == 0 {
 		return true
 		return true
 	}
 	}
-	for _, ss := range s {
-		if ss == "" {
-			return true
-		}
-	}
-	return false
+	return slices.Contains(s, "")
 }
 }
 
 
 // MarshalJSON marshals the multistring as a string or a slice of strings . With
 // MarshalJSON marshals the multistring as a string or a slice of strings . With

+ 1 - 1
authority/export.go

@@ -230,7 +230,7 @@ func mustDuration(d *provisioner.Duration) string {
 	return d.String()
 	return d.String()
 }
 }
 
 
-func mustMarshalToStruct(v interface{}) *structpb.Struct {
+func mustMarshalToStruct(v any) *structpb.Struct {
 	b, err := json.Marshal(v)
 	b, err := json.Marshal(v)
 	if err != nil {
 	if err != nil {
 		panic(errors.Wrapf(err, "error marshaling %T", v))
 		panic(errors.Wrapf(err, "error marshaling %T", v))

+ 5 - 5
authority/linkedca.go

@@ -448,14 +448,14 @@ func serializeCertificate(crt *x509.Certificate) string {
 }
 }
 
 
 func serializeCertificateChain(fullchain ...*x509.Certificate) string {
 func serializeCertificateChain(fullchain ...*x509.Certificate) string {
-	var chain string
+	var chain strings.Builder
 	for _, crt := range fullchain {
 	for _, crt := range fullchain {
-		chain += string(pem.EncodeToMemory(&pem.Block{
+		chain.WriteString(string(pem.EncodeToMemory(&pem.Block{
 			Type:  "CERTIFICATE",
 			Type:  "CERTIFICATE",
 			Bytes: crt.Raw,
 			Bytes: crt.Raw,
-		}))
+		})))
 	}
 	}
-	return chain
+	return chain.String()
 }
 }
 
 
 func serializeSSHCertificate(crt *ssh.Certificate) string {
 func serializeSSHCertificate(crt *ssh.Certificate) string {
@@ -599,7 +599,7 @@ func login(authority, token string, csr *x509.CertificateRequest, signer crypto.
 
 
 	// Add intermediates to the tls.Certificate
 	// Add intermediates to the tls.Certificate
 	last := len(bundle) - 1
 	last := len(bundle) - 1
-	for i := 0; i < last; i++ {
+	for i := range last {
 		cert.Certificate = append(cert.Certificate, bundle[i].Raw)
 		cert.Certificate = append(cert.Certificate, bundle[i].Raw)
 	}
 	}
 
 

+ 2 - 4
authority/provisioner/acme_test.go

@@ -300,8 +300,7 @@ func TestACME_AuthorizeRenew(t *testing.T) {
 			err := tc.p.AuthorizeRenew(context.Background(), tc.cert)
 			err := tc.p.AuthorizeRenew(context.Background(), tc.cert)
 			if tc.err != nil {
 			if tc.err != nil {
 				if assert.Implements(t, (*render.StatusCodedError)(nil), err) {
 				if assert.Implements(t, (*render.StatusCodedError)(nil), err) {
-					var sc render.StatusCodedError
-					if errors.As(err, &sc) {
+					if sc, ok := errors.AsType[render.StatusCodedError](err); ok {
 						assert.Equal(t, tc.code, sc.StatusCode())
 						assert.Equal(t, tc.code, sc.StatusCode())
 					}
 					}
 				}
 				}
@@ -337,8 +336,7 @@ func TestACME_AuthorizeSign(t *testing.T) {
 			opts, err := tc.p.AuthorizeSign(context.Background(), tc.token)
 			opts, err := tc.p.AuthorizeSign(context.Background(), tc.token)
 			if tc.err != nil {
 			if tc.err != nil {
 				if assert.Implements(t, (*render.StatusCodedError)(nil), err) {
 				if assert.Implements(t, (*render.StatusCodedError)(nil), err) {
-					var sc render.StatusCodedError
-					if errors.As(err, &sc) {
+					if sc, ok := errors.AsType[render.StatusCodedError](err); ok {
 						assert.Equal(t, tc.code, sc.StatusCode())
 						assert.Equal(t, tc.code, sc.StatusCode())
 					}
 					}
 				}
 				}

+ 4 - 6
authority/provisioner/aws.go

@@ -13,6 +13,7 @@ import (
 	"net"
 	"net"
 	"net/http"
 	"net/http"
 	"os"
 	"os"
+	"slices"
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
@@ -169,7 +170,7 @@ type AWS struct {
 	DisableCustomSANs      bool     `json:"disableCustomSANs"`
 	DisableCustomSANs      bool     `json:"disableCustomSANs"`
 	DisableTrustOnFirstUse bool     `json:"disableTrustOnFirstUse"`
 	DisableTrustOnFirstUse bool     `json:"disableTrustOnFirstUse"`
 	IMDSVersions           []string `json:"imdsVersions"`
 	IMDSVersions           []string `json:"imdsVersions"`
-	InstanceAge            Duration `json:"instanceAge,omitempty"`
+	InstanceAge            Duration `json:"instanceAge"`
 	IIDRoots               string   `json:"iidRoots,omitempty"`
 	IIDRoots               string   `json:"iidRoots,omitempty"`
 	Claims                 *Claims  `json:"claims,omitempty"`
 	Claims                 *Claims  `json:"claims,omitempty"`
 	Options                *Options `json:"options,omitempty"`
 	Options                *Options `json:"options,omitempty"`
@@ -590,11 +591,8 @@ func (p *AWS) authorizeToken(token string) (*awsPayload, error) {
 	// validate accounts
 	// validate accounts
 	if len(p.Accounts) > 0 {
 	if len(p.Accounts) > 0 {
 		var found bool
 		var found bool
-		for _, sa := range p.Accounts {
-			if sa == doc.AccountID {
-				found = true
-				break
-			}
+		if slices.Contains(p.Accounts, doc.AccountID) {
+			found = true
 		}
 		}
 		if !found {
 		if !found {
 			return nil, errs.Unauthorized("aws.authorizeToken; invalid aws identity document - accountId is not valid")
 			return nil, errs.Unauthorized("aws.authorizeToken; invalid aws identity document - accountId is not valid")

+ 1 - 1
authority/provisioner/aws_test.go

@@ -776,7 +776,7 @@ func TestAWS_AuthorizeSSHSign(t *testing.T) {
 	type args struct {
 	type args struct {
 		token   string
 		token   string
 		sshOpts SignSSHOptions
 		sshOpts SignSSHOptions
-		key     interface{}
+		key     any
 	}
 	}
 	tests := []struct {
 	tests := []struct {
 		name        string
 		name        string

+ 7 - 15
authority/provisioner/azure.go

@@ -9,6 +9,7 @@ import (
 	"io"
 	"io"
 	"net/http"
 	"net/http"
 	"regexp"
 	"regexp"
+	"slices"
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
@@ -325,11 +326,8 @@ func (p *Azure) AuthorizeSign(ctx context.Context, token string) ([]SignOption,
 	// Filter by resource group
 	// Filter by resource group
 	if len(p.ResourceGroups) > 0 {
 	if len(p.ResourceGroups) > 0 {
 		var found bool
 		var found bool
-		for _, g := range p.ResourceGroups {
-			if g == group {
-				found = true
-				break
-			}
+		if slices.Contains(p.ResourceGroups, group) {
+			found = true
 		}
 		}
 		if !found {
 		if !found {
 			return nil, errs.Unauthorized("azure.AuthorizeSign; azure token validation failed - invalid resource group")
 			return nil, errs.Unauthorized("azure.AuthorizeSign; azure token validation failed - invalid resource group")
@@ -339,11 +337,8 @@ func (p *Azure) AuthorizeSign(ctx context.Context, token string) ([]SignOption,
 	// Filter by subscription id
 	// Filter by subscription id
 	if len(p.SubscriptionIDs) > 0 {
 	if len(p.SubscriptionIDs) > 0 {
 		var found bool
 		var found bool
-		for _, s := range p.SubscriptionIDs {
-			if s == subscription {
-				found = true
-				break
-			}
+		if slices.Contains(p.SubscriptionIDs, subscription) {
+			found = true
 		}
 		}
 		if !found {
 		if !found {
 			return nil, errs.Unauthorized("azure.AuthorizeSign; azure token validation failed - invalid subscription id")
 			return nil, errs.Unauthorized("azure.AuthorizeSign; azure token validation failed - invalid subscription id")
@@ -353,11 +348,8 @@ func (p *Azure) AuthorizeSign(ctx context.Context, token string) ([]SignOption,
 	// Filter by Azure AD identity object id
 	// Filter by Azure AD identity object id
 	if len(p.ObjectIDs) > 0 {
 	if len(p.ObjectIDs) > 0 {
 		var found bool
 		var found bool
-		for _, i := range p.ObjectIDs {
-			if i == identityObjectID {
-				found = true
-				break
-			}
+		if slices.Contains(p.ObjectIDs, identityObjectID) {
+			found = true
 		}
 		}
 		if !found {
 		if !found {
 			return nil, errs.Unauthorized("azure.AuthorizeSign; azure token validation failed - invalid identity object id")
 			return nil, errs.Unauthorized("azure.AuthorizeSign; azure token validation failed - invalid identity object id")

+ 1 - 1
authority/provisioner/azure_test.go

@@ -680,7 +680,7 @@ func TestAzure_AuthorizeSSHSign(t *testing.T) {
 	type args struct {
 	type args struct {
 		token   string
 		token   string
 		sshOpts SignSSHOptions
 		sshOpts SignSSHOptions
-		key     interface{}
+		key     any
 	}
 	}
 	tests := []struct {
 	tests := []struct {
 		name        string
 		name        string

+ 1 - 1
authority/provisioner/gcp.go

@@ -105,7 +105,7 @@ type GCP struct {
 	DisableTrustOnFirstUse bool     `json:"disableTrustOnFirstUse"`
 	DisableTrustOnFirstUse bool     `json:"disableTrustOnFirstUse"`
 	DisableSSHCAUser       *bool    `json:"disableSSHCAUser,omitempty"`
 	DisableSSHCAUser       *bool    `json:"disableSSHCAUser,omitempty"`
 	DisableSSHCAHost       *bool    `json:"disableSSHCAHost,omitempty"`
 	DisableSSHCAHost       *bool    `json:"disableSSHCAHost,omitempty"`
-	InstanceAge            Duration `json:"instanceAge,omitempty"`
+	InstanceAge            Duration `json:"instanceAge"`
 	Claims                 *Claims  `json:"claims,omitempty"`
 	Claims                 *Claims  `json:"claims,omitempty"`
 	Options                *Options `json:"options,omitempty"`
 	Options                *Options `json:"options,omitempty"`
 	config                 *gcpConfig
 	config                 *gcpConfig

+ 3 - 4
authority/provisioner/gcp/projectvalidator.go

@@ -3,6 +3,7 @@ package gcp
 import (
 import (
 	"context"
 	"context"
 	"net/http"
 	"net/http"
+	"slices"
 
 
 	"google.golang.org/api/cloudresourcemanager/v1"
 	"google.golang.org/api/cloudresourcemanager/v1"
 
 
@@ -18,10 +19,8 @@ func (p *ProjectValidator) ValidateProject(_ context.Context, projectID string)
 		return nil
 		return nil
 	}
 	}
 
 
-	for _, pi := range p.ProjectIDs {
-		if pi == projectID {
-			return nil
-		}
+	if slices.Contains(p.ProjectIDs, projectID) {
+		return nil
 	}
 	}
 
 
 	return errs.Unauthorized("gcp.authorizeToken; invalid gcp token - invalid project id")
 	return errs.Unauthorized("gcp.authorizeToken; invalid gcp token - invalid project id")

+ 1 - 1
authority/provisioner/gcp_test.go

@@ -674,7 +674,7 @@ func TestGCP_AuthorizeSSHSign(t *testing.T) {
 	type args struct {
 	type args struct {
 		token   string
 		token   string
 		sshOpts SignSSHOptions
 		sshOpts SignSSHOptions
-		key     interface{}
+		key     any
 	}
 	}
 	tests := []struct {
 	tests := []struct {
 		name        string
 		name        string

+ 1 - 1
authority/provisioner/jwk_test.go

@@ -470,7 +470,7 @@ func TestJWK_AuthorizeSSHSign(t *testing.T) {
 	type args struct {
 	type args struct {
 		token   string
 		token   string
 		sshOpts SignSSHOptions
 		sshOpts SignSSHOptions
-		key     interface{}
+		key     any
 	}
 	}
 	tests := []struct {
 	tests := []struct {
 		name        string
 		name        string

+ 4 - 8
authority/provisioner/k8sSA.go

@@ -2,9 +2,6 @@ package provisioner
 
 
 import (
 import (
 	"context"
 	"context"
-	"crypto/ecdsa"
-	"crypto/ed25519"
-	"crypto/rsa"
 	"crypto/x509"
 	"crypto/x509"
 	"encoding/pem"
 	"encoding/pem"
 	"net/http"
 	"net/http"
@@ -18,6 +15,7 @@ import (
 	"go.step.sm/crypto/x509util"
 	"go.step.sm/crypto/x509util"
 
 
 	"github.com/smallstep/certificates/errs"
 	"github.com/smallstep/certificates/errs"
+	"github.com/smallstep/certificates/internal/cryptoutil"
 )
 )
 
 
 // NOTE: There can be at most one kubernetes service account provisioner configured
 // NOTE: There can be at most one kubernetes service account provisioner configured
@@ -52,7 +50,7 @@ type K8sSA struct {
 	Claims  *Claims  `json:"claims,omitempty"`
 	Claims  *Claims  `json:"claims,omitempty"`
 	Options *Options `json:"options,omitempty"`
 	Options *Options `json:"options,omitempty"`
 	//kauthn    kauthn.AuthenticationV1Interface
 	//kauthn    kauthn.AuthenticationV1Interface
-	pubKeys []interface{}
+	pubKeys []any
 	ctl     *Controller
 	ctl     *Controller
 }
 }
 
 
@@ -115,10 +113,8 @@ func (p *K8sSA) Init(config Config) (err error) {
 			if err != nil {
 			if err != nil {
 				return errors.Wrapf(err, "error parsing public key in provisioner '%s'", p.GetName())
 				return errors.Wrapf(err, "error parsing public key in provisioner '%s'", p.GetName())
 			}
 			}
-			switch q := key.(type) {
-			case *rsa.PublicKey, *ecdsa.PublicKey, ed25519.PublicKey:
-			default:
-				return errors.Errorf("Unexpected public key type %T in provisioner '%s'", q, p.GetName())
+			if !cryptoutil.IsSupportedPublicKey(key) {
+				return errors.Errorf("Unexpected public key type %T in provisioner %q", key, p.GetName())
 			}
 			}
 			p.pubKeys = append(p.pubKeys, key)
 			p.pubKeys = append(p.pubKeys, key)
 		}
 		}

+ 3 - 5
authority/provisioner/nebula.go

@@ -12,6 +12,7 @@ import (
 	"math/big"
 	"math/big"
 	"net"
 	"net"
 	"net/netip"
 	"net/netip"
+	"slices"
 	"time"
 	"time"
 
 
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
@@ -413,11 +414,8 @@ func (v nebulaSANsValidator) Valid(req *x509.CertificateRequest) error {
 		for _, ip := range req.IPAddresses {
 		for _, ip := range req.IPAddresses {
 			var valid bool
 			var valid bool
 			// Check ip in name
 			// Check ip in name
-			for _, ipInName := range ips {
-				if ip.Equal(ipInName) {
-					valid = true
-					break
-				}
+			if slices.ContainsFunc(ips, ip.Equal) {
+				valid = true
 			}
 			}
 			// Check ip network
 			// Check ip network
 			if !valid {
 			if !valid {

+ 6 - 10
authority/provisioner/oidc.go

@@ -8,6 +8,7 @@ import (
 	"net/http"
 	"net/http"
 	"net/url"
 	"net/url"
 	"path"
 	"path"
+	"slices"
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
@@ -65,10 +66,8 @@ func (o *openIDPayload) IsAdmin(admins []string) bool {
 	// The groups and emails can be in the same array for now, but consider
 	// The groups and emails can be in the same array for now, but consider
 	// making a specialized option later.
 	// making a specialized option later.
 	for _, name := range o.Groups {
 	for _, name := range o.Groups {
-		for _, admin := range admins {
-			if name == admin {
-				return true
-			}
+		if slices.Contains(admins, name) {
+			return true
 		}
 		}
 	}
 	}
 
 
@@ -246,11 +245,8 @@ func (o *OIDC) ValidatePayload(p openIDPayload) error {
 	if len(o.Groups) > 0 {
 	if len(o.Groups) > 0 {
 		var found bool
 		var found bool
 		for _, group := range o.Groups {
 		for _, group := range o.Groups {
-			for _, g := range p.Groups {
-				if g == group {
-					found = true
-					break
-				}
+			if slices.Contains(p.Groups, group) {
+				found = true
 			}
 			}
 		}
 		}
 		if !found {
 		if !found {
@@ -485,7 +481,7 @@ func (o *OIDC) AuthorizeSSHRevoke(_ context.Context, token string) error {
 	return errs.Unauthorized("oidc.AuthorizeSSHRevoke; cannot revoke with non-admin oidc token")
 	return errs.Unauthorized("oidc.AuthorizeSSHRevoke; cannot revoke with non-admin oidc token")
 }
 }
 
 
-func getAndDecode(client HTTPClient, uri string, v interface{}) error {
+func getAndDecode(client HTTPClient, uri string, v any) error {
 	resp, err := client.Get(uri)
 	resp, err := client.Get(uri)
 	if err != nil {
 	if err != nil {
 		return errors.Wrapf(err, "failed to connect to %s", uri)
 		return errors.Wrapf(err, "failed to connect to %s", uri)

+ 1 - 1
authority/provisioner/oidc_test.go

@@ -577,7 +577,7 @@ func TestOIDC_AuthorizeSSHSign(t *testing.T) {
 	type args struct {
 	type args struct {
 		token   string
 		token   string
 		sshOpts SignSSHOptions
 		sshOpts SignSSHOptions
-		key     interface{}
+		key     any
 	}
 	}
 	tests := []struct {
 	tests := []struct {
 		name        string
 		name        string

+ 4 - 4
authority/provisioner/options.go

@@ -164,9 +164,9 @@ func CustomTemplateOptions(o *Options, data x509util.TemplateData, defaultTempla
 
 
 		// Add user provided data.
 		// Add user provided data.
 		if len(so.TemplateData) > 0 {
 		if len(so.TemplateData) > 0 {
-			userObject := make(map[string]interface{})
+			userObject := make(map[string]any)
 			if err := json.Unmarshal(so.TemplateData, &userObject); err != nil {
 			if err := json.Unmarshal(so.TemplateData, &userObject); err != nil {
-				data.SetUserData(map[string]interface{}{})
+				data.SetUserData(map[string]any{})
 			} else {
 			} else {
 				data.SetUserData(userObject)
 				data.SetUserData(userObject)
 			}
 			}
@@ -196,12 +196,12 @@ func CustomTemplateOptions(o *Options, data x509util.TemplateData, defaultTempla
 
 
 // unsafeParseSigned parses the given token and returns all the claims without
 // unsafeParseSigned parses the given token and returns all the claims without
 // verifying the signature of the token.
 // verifying the signature of the token.
-func unsafeParseSigned(s string) (map[string]interface{}, error) {
+func unsafeParseSigned(s string) (map[string]any, error) {
 	token, err := jose.ParseSigned(s)
 	token, err := jose.ParseSigned(s)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	claims := make(map[string]interface{})
+	claims := make(map[string]any)
 	if err := token.UnsafeClaimsWithoutVerification(&claims); err != nil {
 	if err := token.UnsafeClaimsWithoutVerification(&claims); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}

+ 2 - 2
authority/provisioner/options_test.go

@@ -292,10 +292,10 @@ func Test_unsafeParseSigned(t *testing.T) {
 	tests := []struct {
 	tests := []struct {
 		name    string
 		name    string
 		args    args
 		args    args
-		want    map[string]interface{}
+		want    map[string]any
 		wantErr bool
 		wantErr bool
 	}{
 	}{
-		{"ok", args{okToken}, map[string]interface{}{
+		{"ok", args{okToken}, map[string]any{
 			"sub": "jane@doe.com",
 			"sub": "jane@doe.com",
 			"iss": "https://doe.com",
 			"iss": "https://doe.com",
 			"jti": "8ff32481-fd5f-4e2e-96df-908c127c85f7",
 			"jti": "8ff32481-fd5f-4e2e-96df-908c127c85f7",

+ 1 - 1
authority/provisioner/provisioner.go

@@ -427,7 +427,7 @@ func (p *raProvisioner) RAInfo() *RAInfo {
 
 
 // MockProvisioner for testing
 // MockProvisioner for testing
 type MockProvisioner struct {
 type MockProvisioner struct {
-	Mret1, Mret2, Mret3 interface{}
+	Mret1, Mret2, Mret3 any
 	Merr                error
 	Merr                error
 	MgetID              func() string
 	MgetID              func() string
 	MgetIDForToken      func() string
 	MgetIDForToken      func() string

+ 15 - 25
authority/provisioner/sign_options.go

@@ -2,8 +2,6 @@ package provisioner
 
 
 import (
 import (
 	"context"
 	"context"
-	"crypto/ecdsa"
-	"crypto/ed25519"
 	"crypto/rsa"
 	"crypto/rsa"
 	"crypto/sha256"
 	"crypto/sha256"
 	"crypto/subtle"
 	"crypto/subtle"
@@ -14,6 +12,7 @@ import (
 	"net/http"
 	"net/http"
 	"net/url"
 	"net/url"
 	"reflect"
 	"reflect"
+	"slices"
 	"time"
 	"time"
 
 
 	"go.step.sm/crypto/keyutil"
 	"go.step.sm/crypto/keyutil"
@@ -21,6 +20,7 @@ import (
 
 
 	"github.com/smallstep/certificates/authority/policy"
 	"github.com/smallstep/certificates/authority/policy"
 	"github.com/smallstep/certificates/errs"
 	"github.com/smallstep/certificates/errs"
+	"github.com/smallstep/certificates/internal/cryptoutil"
 )
 )
 
 
 // DefaultCertValidity is the default validity for a certificate if none is specified.
 // DefaultCertValidity is the default validity for a certificate if none is specified.
@@ -37,7 +37,7 @@ type SignOptions struct {
 
 
 // SignOption is the interface used to collect all extra options used in the
 // SignOption is the interface used to collect all extra options used in the
 // Sign method.
 // Sign method.
-type SignOption interface{}
+type SignOption any
 
 
 // CertificateValidator is an interface used to validate a given X.509 certificate.
 // CertificateValidator is an interface used to validate a given X.509 certificate.
 type CertificateValidator interface {
 type CertificateValidator interface {
@@ -92,17 +92,7 @@ type defaultPublicKeyValidator struct{}
 
 
 // Valid checks that certificate request common name matches the one configured.
 // Valid checks that certificate request common name matches the one configured.
 func (v defaultPublicKeyValidator) Valid(req *x509.CertificateRequest) error {
 func (v defaultPublicKeyValidator) Valid(req *x509.CertificateRequest) error {
-	switch k := req.PublicKey.(type) {
-	case *rsa.PublicKey:
-		if k.Size() < keyutil.MinRSAKeyBytes {
-			return errs.Forbidden("certificate request RSA key must be at least %d bits (%d bytes)",
-				8*keyutil.MinRSAKeyBytes, keyutil.MinRSAKeyBytes)
-		}
-	case *ecdsa.PublicKey, ed25519.PublicKey:
-	default:
-		return errs.BadRequest("certificate request key of type '%T' is not supported", k)
-	}
-	return nil
+	return newPublicKeyMinimumLengthValidator(8 * keyutil.MinRSAKeyBytes).Valid(req)
 }
 }
 
 
 // publicKeyMinimumLengthValidator validates the length (in bits) of the public key
 // publicKeyMinimumLengthValidator validates the length (in bits) of the public key
@@ -122,18 +112,20 @@ func newPublicKeyMinimumLengthValidator(length int) publicKeyMinimumLengthValida
 
 
 // Valid checks that certificate request common name matches the one configured.
 // Valid checks that certificate request common name matches the one configured.
 func (v publicKeyMinimumLengthValidator) Valid(req *x509.CertificateRequest) error {
 func (v publicKeyMinimumLengthValidator) Valid(req *x509.CertificateRequest) error {
-	switch k := req.PublicKey.(type) {
-	case *rsa.PublicKey:
+	if rsaKey, ok := req.PublicKey.(*rsa.PublicKey); ok {
 		minimumLengthInBytes := v.length / 8
 		minimumLengthInBytes := v.length / 8
-		if k.Size() < minimumLengthInBytes {
+		if rsaKey.Size() < minimumLengthInBytes {
 			return errs.Forbidden("certificate request RSA key must be at least %d bits (%d bytes)",
 			return errs.Forbidden("certificate request RSA key must be at least %d bits (%d bytes)",
 				v.length, minimumLengthInBytes)
 				v.length, minimumLengthInBytes)
 		}
 		}
-	case *ecdsa.PublicKey, ed25519.PublicKey:
-	default:
-		return errs.BadRequest("certificate request key of type '%T' is not supported", k)
+		return nil
 	}
 	}
-	return nil
+
+	if cryptoutil.IsSupportedPublicKey(req.PublicKey) {
+		return nil
+	}
+
+	return errs.BadRequest("certificate request key of type '%T' is not supported", req.PublicKey)
 }
 }
 
 
 // commonNameValidator validates the common name of a certificate request.
 // commonNameValidator validates the common name of a certificate request.
@@ -159,10 +151,8 @@ func (v commonNameSliceValidator) Valid(req *x509.CertificateRequest) error {
 	if req.Subject.CommonName == "" {
 	if req.Subject.CommonName == "" {
 		return nil
 		return nil
 	}
 	}
-	for _, cn := range v {
-		if req.Subject.CommonName == cn {
-			return nil
-		}
+	if slices.Contains(v, req.Subject.CommonName) {
+		return nil
 	}
 	}
 	return errs.Forbidden("certificate request does not contain the valid common name - got %s, want %s", req.Subject.CommonName, v)
 	return errs.Forbidden("certificate request does not contain the valid common name - got %s, want %s", req.Subject.CommonName, v)
 }
 }

+ 7 - 8
authority/provisioner/sign_ssh_options.go

@@ -6,6 +6,7 @@ import (
 	"encoding/json"
 	"encoding/json"
 	"fmt"
 	"fmt"
 	"math/big"
 	"math/big"
+	"slices"
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
@@ -59,8 +60,8 @@ type SignSSHOptions struct {
 	CertType     string          `json:"certType"`
 	CertType     string          `json:"certType"`
 	KeyID        string          `json:"keyID"`
 	KeyID        string          `json:"keyID"`
 	Principals   []string        `json:"principals"`
 	Principals   []string        `json:"principals"`
-	ValidAfter   TimeDuration    `json:"validAfter,omitempty"`
-	ValidBefore  TimeDuration    `json:"validBefore,omitempty"`
+	ValidAfter   TimeDuration    `json:"validAfter"`
+	ValidBefore  TimeDuration    `json:"validBefore"`
 	TemplateData json.RawMessage `json:"templateData,omitempty"`
 	TemplateData json.RawMessage `json:"templateData,omitempty"`
 	Backdate     time.Duration   `json:"-"`
 	Backdate     time.Duration   `json:"-"`
 }
 }
@@ -70,10 +71,8 @@ func (o SignSSHOptions) Validate() error {
 	if o.CertType != "" && o.CertType != SSHUserCert && o.CertType != SSHHostCert {
 	if o.CertType != "" && o.CertType != SSHUserCert && o.CertType != SSHHostCert {
 		return errs.BadRequest("certType '%s' is not valid", o.CertType)
 		return errs.BadRequest("certType '%s' is not valid", o.CertType)
 	}
 	}
-	for _, p := range o.Principals {
-		if p == "" {
-			return errs.BadRequest("principals cannot contain empty values")
-		}
+	if slices.Contains(o.Principals, "") {
+		return errs.BadRequest("principals cannot contain empty values")
 	}
 	}
 	return nil
 	return nil
 }
 }
@@ -448,10 +447,10 @@ func containsAllMembers(group, subgroup []string) bool {
 		return false
 		return false
 	}
 	}
 	visit := make(map[string]struct{}, lg)
 	visit := make(map[string]struct{}, lg)
-	for i := 0; i < lg; i++ {
+	for i := range lg {
 		visit[strings.ToLower(group[i])] = struct{}{}
 		visit[strings.ToLower(group[i])] = struct{}{}
 	}
 	}
-	for i := 0; i < lsg; i++ {
+	for i := range lsg {
 		if _, ok := visit[strings.ToLower(subgroup[i])]; !ok {
 		if _, ok := visit[strings.ToLower(subgroup[i])]; !ok {
 			return false
 			return false
 		}
 		}

+ 2 - 2
authority/provisioner/ssh_options.go

@@ -135,9 +135,9 @@ func CustomSSHTemplateOptions(o *Options, data sshutil.TemplateData, defaultTemp
 
 
 		// Add user provided data.
 		// Add user provided data.
 		if len(so.TemplateData) > 0 {
 		if len(so.TemplateData) > 0 {
-			userObject := make(map[string]interface{})
+			userObject := make(map[string]any)
 			if err := json.Unmarshal(so.TemplateData, &userObject); err != nil {
 			if err := json.Unmarshal(so.TemplateData, &userObject); err != nil {
-				data.SetUserData(map[string]interface{}{})
+				data.SetUserData(map[string]any{})
 			} else {
 			} else {
 				data.SetUserData(userObject)
 				data.SetUserData(userObject)
 			}
 			}

+ 1 - 2
authority/provisioner/ssh_test.go

@@ -90,8 +90,7 @@ func signSSHCertificate(key crypto.PublicKey, opts SignSSHOptions, signOpts []Si
 	// Create certificate from template.
 	// Create certificate from template.
 	certificate, err := sshutil.NewCertificate(cr, certOptions...)
 	certificate, err := sshutil.NewCertificate(cr, certOptions...)
 	if err != nil {
 	if err != nil {
-		var templErr *sshutil.TemplateError
-		if errors.As(err, &templErr) {
+		if templErr, ok := errors.AsType[*sshutil.TemplateError](err); ok {
 			return nil, errs.NewErr(http.StatusBadRequest, templErr,
 			return nil, errs.NewErr(http.StatusBadRequest, templErr,
 				errs.WithMessage("%s", templErr.Error()),
 				errs.WithMessage("%s", templErr.Error()),
 				errs.WithKeyVal("signOptions", signOpts),
 				errs.WithKeyVal("signOptions", signOpts),

+ 8 - 8
authority/provisioner/utils_test.go

@@ -86,7 +86,7 @@ O4vZCKd4vzljH6eL+OECQHHxhYoTW7lFpKGnUDG9fPZ3eYzWpgka6w1vvBk10BAu
 6fbwppM9pQ7DPMg7V6YGEjjT0gX9B9TttfHxGhvtZNQ=
 6fbwppM9pQ7DPMg7V6YGEjjT0gX9B9TttfHxGhvtZNQ=
 -----END RSA PRIVATE KEY-----`
 -----END RSA PRIVATE KEY-----`
 
 
-func must(args ...interface{}) []interface{} {
+func must(args ...any) []any {
 	if l := len(args); l > 0 && args[l-1] != nil {
 	if l := len(args); l > 0 && args[l-1] != nil {
 		if err, ok := args[l-1].(error); ok {
 		if err, ok := args[l-1].(error); ok {
 			panic(err)
 			panic(err)
@@ -110,7 +110,7 @@ func generateJSONWebKey() (*jose.JSONWebKey, error) {
 
 
 func generateJSONWebKeySet(n int) (jose.JSONWebKeySet, error) {
 func generateJSONWebKeySet(n int) (jose.JSONWebKeySet, error) {
 	var keySet jose.JSONWebKeySet
 	var keySet jose.JSONWebKeySet
-	for i := 0; i < n; i++ {
+	for range n {
 		key, err := generateJSONWebKey()
 		key, err := generateJSONWebKey()
 		if err != nil {
 		if err != nil {
 			return jose.JSONWebKeySet{}, err
 			return jose.JSONWebKeySet{}, err
@@ -192,7 +192,7 @@ func generateJWK() (*JWK, error) {
 	return p, err
 	return p, err
 }
 }
 
 
-func generateK8sSA(inputPubKey interface{}) (*K8sSA, error) {
+func generateK8sSA(inputPubKey any) (*K8sSA, error) {
 	fooPubB, err := os.ReadFile("./testdata/certs/foo.pub")
 	fooPubB, err := os.ReadFile("./testdata/certs/foo.pub")
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
@@ -210,7 +210,7 @@ func generateK8sSA(inputPubKey interface{}) (*K8sSA, error) {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	pubKeys := []interface{}{fooPub, barPub}
+	pubKeys := []any{fooPub, barPub}
 	if inputPubKey != nil {
 	if inputPubKey != nil {
 		pubKeys = append(pubKeys, inputPubKey)
 		pubKeys = append(pubKeys, inputPubKey)
 	}
 	}
@@ -625,7 +625,7 @@ func generateAzureWithServer() (*Azure, *httptest.Server, error) {
 	if err != nil {
 	if err != nil {
 		return nil, nil, err
 		return nil, nil, err
 	}
 	}
-	writeJSON := func(w http.ResponseWriter, v interface{}) {
+	writeJSON := func(w http.ResponseWriter, v any) {
 		b, err := json.Marshal(v)
 		b, err := json.Marshal(v)
 		if err != nil {
 		if err != nil {
 			w.WriteHeader(http.StatusInternalServerError)
 			w.WriteHeader(http.StatusInternalServerError)
@@ -688,14 +688,14 @@ func generateAzureWithServer() (*Azure, *httptest.Server, error) {
 
 
 func generateCollection(nJWK, nOIDC int) (*Collection, error) {
 func generateCollection(nJWK, nOIDC int) (*Collection, error) {
 	col := NewCollection(testAudiences)
 	col := NewCollection(testAudiences)
-	for i := 0; i < nJWK; i++ {
+	for range nJWK {
 		p, err := generateJWK()
 		p, err := generateJWK()
 		if err != nil {
 		if err != nil {
 			return nil, err
 			return nil, err
 		}
 		}
 		col.Store(p)
 		col.Store(p)
 	}
 	}
-	for i := 0; i < nOIDC; i++ {
+	for range nOIDC {
 		p, err := generateOIDC()
 		p, err := generateOIDC()
 		if err != nil {
 		if err != nil {
 			return nil, err
 			return nil, err
@@ -1108,7 +1108,7 @@ func generateJWKServerHandler(n int, srv *httptest.Server) http.Handler {
 	hits := struct {
 	hits := struct {
 		Hits int `json:"hits"`
 		Hits int `json:"hits"`
 	}{}
 	}{}
-	writeJSON := func(w http.ResponseWriter, v interface{}) {
+	writeJSON := func(w http.ResponseWriter, v any) {
 		b, err := json.Marshal(v)
 		b, err := json.Marshal(v)
 		if err != nil {
 		if err != nil {
 			w.WriteHeader(http.StatusInternalServerError)
 			w.WriteHeader(http.StatusInternalServerError)

+ 7 - 7
authority/provisioner/webhook_test.go

@@ -458,7 +458,7 @@ func TestWebhook_Do(t *testing.T) {
 			},
 			},
 			requestID: "reqID",
 			requestID: "reqID",
 			webhookResponse: webhook.ResponseBody{
 			webhookResponse: webhook.ResponseBody{
-				Data: map[string]interface{}{"role": "dba"},
+				Data: map[string]any{"role": "dba"},
 			},
 			},
 		},
 		},
 		"ok/no-request-id": {
 		"ok/no-request-id": {
@@ -467,7 +467,7 @@ func TestWebhook_Do(t *testing.T) {
 				Secret: "c2VjcmV0Cg==",
 				Secret: "c2VjcmV0Cg==",
 			},
 			},
 			webhookResponse: webhook.ResponseBody{
 			webhookResponse: webhook.ResponseBody{
-				Data: map[string]interface{}{"role": "dba"},
+				Data: map[string]any{"role": "dba"},
 			},
 			},
 		},
 		},
 		"ok/bearer": {
 		"ok/bearer": {
@@ -478,7 +478,7 @@ func TestWebhook_Do(t *testing.T) {
 			},
 			},
 			requestID: "reqID",
 			requestID: "reqID",
 			webhookResponse: webhook.ResponseBody{
 			webhookResponse: webhook.ResponseBody{
-				Data: map[string]interface{}{"role": "dba"},
+				Data: map[string]any{"role": "dba"},
 			},
 			},
 		},
 		},
 		"ok/basic": {
 		"ok/basic": {
@@ -495,7 +495,7 @@ func TestWebhook_Do(t *testing.T) {
 			},
 			},
 			requestID: "reqID",
 			requestID: "reqID",
 			webhookResponse: webhook.ResponseBody{
 			webhookResponse: webhook.ResponseBody{
-				Data: map[string]interface{}{"role": "dba"},
+				Data: map[string]any{"role": "dba"},
 			},
 			},
 		},
 		},
 		"ok/templated-url": {
 		"ok/templated-url": {
@@ -506,9 +506,9 @@ func TestWebhook_Do(t *testing.T) {
 				Secret: "c2VjcmV0Cg==",
 				Secret: "c2VjcmV0Cg==",
 			},
 			},
 			requestID: "reqID",
 			requestID: "reqID",
-			dataArg:   map[string]interface{}{"username": "areed", "region": "central"},
+			dataArg:   map[string]any{"username": "areed", "region": "central"},
 			webhookResponse: webhook.ResponseBody{
 			webhookResponse: webhook.ResponseBody{
-				Data: map[string]interface{}{"role": "dba"},
+				Data: map[string]any{"role": "dba"},
 			},
 			},
 			expectPath: "/users/areed?region=central",
 			expectPath: "/users/areed?region=central",
 		},
 		},
@@ -552,7 +552,7 @@ func TestWebhook_Do(t *testing.T) {
 				Secret: "c2VjcmV0Cg==",
 				Secret: "c2VjcmV0Cg==",
 			},
 			},
 			webhookResponse: webhook.ResponseBody{
 			webhookResponse: webhook.ResponseBody{
-				Data: map[string]interface{}{"role": "dba"},
+				Data: map[string]any{"role": "dba"},
 			},
 			},
 			requestID:     "reqID",
 			requestID:     "reqID",
 			errStatusCode: 404,
 			errStatusCode: 404,

+ 1 - 1
authority/root.go

@@ -45,7 +45,7 @@ func (a *Authority) GetRoots() ([]*x509.Certificate, error) {
 // GetFederation returns all the root certificates in the federation.
 // GetFederation returns all the root certificates in the federation.
 // This method implements the Authority interface.
 // This method implements the Authority interface.
 func (a *Authority) GetFederation() (federation []*x509.Certificate, err error) {
 func (a *Authority) GetFederation() (federation []*x509.Certificate, err error) {
-	a.certificates.Range(func(_, v interface{}) bool {
+	a.certificates.Range(func(_, v any) bool {
 		crt, ok := v.(*x509.Certificate)
 		crt, ok := v.(*x509.Certificate)
 		if !ok {
 		if !ok {
 			federation = nil
 			federation = nil

+ 5 - 7
authority/ssh.go

@@ -6,6 +6,7 @@ import (
 	"crypto/x509"
 	"crypto/x509"
 	"encoding/binary"
 	"encoding/binary"
 	"errors"
 	"errors"
+	"maps"
 	"net/http"
 	"net/http"
 	"strings"
 	"strings"
 	"time"
 	"time"
@@ -77,16 +78,14 @@ func (a *Authority) GetSSHConfig(_ context.Context, typ string, data map[string]
 	}
 	}
 
 
 	// Merge user and default data
 	// Merge user and default data
-	var mergedData map[string]interface{}
+	var mergedData map[string]any
 
 
 	if len(data) == 0 {
 	if len(data) == 0 {
 		mergedData = a.templates.Data
 		mergedData = a.templates.Data
 	} else {
 	} else {
-		mergedData = make(map[string]interface{}, len(a.templates.Data)+1)
+		mergedData = make(map[string]any, len(a.templates.Data)+1)
 		mergedData["User"] = data
 		mergedData["User"] = data
-		for k, v := range a.templates.Data {
-			mergedData[k] = v
-		}
+		maps.Copy(mergedData, a.templates.Data)
 	}
 	}
 
 
 	// Render templates
 	// Render templates
@@ -293,8 +292,7 @@ func (a *Authority) signSSH(ctx context.Context, key ssh.PublicKey, opts provisi
 
 
 	// Check if authority is allowed to sign the certificate
 	// Check if authority is allowed to sign the certificate
 	if err := a.isAllowedToSignSSHCertificate(certTpl); err != nil {
 	if err := a.isAllowedToSignSSHCertificate(certTpl); err != nil {
-		var ee *errs.Error
-		if errors.As(err, &ee) {
+		if ee, ok := errors.AsType[*errs.Error](err); ok {
 			return nil, prov, ee
 			return nil, prov, ee
 		}
 		}
 		return nil, prov, errs.InternalServerErr(err,
 		return nil, prov, errs.InternalServerErr(err,

+ 3 - 3
authority/ssh_test.go

@@ -519,7 +519,7 @@ func TestAuthority_GetSSHConfig(t *testing.T) {
 				{Name: "ca.tpl", Type: templates.File, TemplatePath: "./testdata/templates/ca.tpl", Path: "/etc/ssh/ca.pub", Comment: "#"},
 				{Name: "ca.tpl", Type: templates.File, TemplatePath: "./testdata/templates/ca.tpl", Path: "/etc/ssh/ca.pub", Comment: "#"},
 			},
 			},
 		},
 		},
-		Data: map[string]interface{}{
+		Data: map[string]any{
 			"Step": &templates.Step{
 			"Step": &templates.Step{
 				SSH: templates.StepSSH{
 				SSH: templates.StepSSH{
 					UserKey: user,
 					UserKey: user,
@@ -552,7 +552,7 @@ func TestAuthority_GetSSHConfig(t *testing.T) {
 				},
 				},
 			},
 			},
 		},
 		},
-		Data: map[string]interface{}{
+		Data: map[string]any{
 			"Step": &templates.Step{
 			"Step": &templates.Step{
 				SSH: templates.StepSSH{
 				SSH: templates.StepSSH{
 					UserKey: user,
 					UserKey: user,
@@ -575,7 +575,7 @@ func TestAuthority_GetSSHConfig(t *testing.T) {
 				{Name: "step_includes.tpl", Type: templates.PrependLine, TemplatePath: "./testdata/templates/step_includes.tpl", Path: "${STEPPATH}/ssh/includes", Comment: "#"},
 				{Name: "step_includes.tpl", Type: templates.PrependLine, TemplatePath: "./testdata/templates/step_includes.tpl", Path: "${STEPPATH}/ssh/includes", Comment: "#"},
 			},
 			},
 		},
 		},
-		Data: map[string]interface{}{
+		Data: map[string]any{
 			"Step": &templates.Step{
 			"Step": &templates.Step{
 				SSH: templates.StepSSH{
 				SSH: templates.StepSSH{
 					UserKey: user,
 					UserKey: user,

+ 1 - 1
authority/tls.go

@@ -573,7 +573,7 @@ type RevokeOptions struct {
 //
 //
 // TODO: Add OCSP and CRL support.
 // TODO: Add OCSP and CRL support.
 func (a *Authority) Revoke(ctx context.Context, revokeOpts *RevokeOptions) error {
 func (a *Authority) Revoke(ctx context.Context, revokeOpts *RevokeOptions) error {
-	opts := []interface{}{
+	opts := []any{
 		errs.WithKeyVal("serialNumber", revokeOpts.Serial),
 		errs.WithKeyVal("serialNumber", revokeOpts.Serial),
 		errs.WithKeyVal("reasonCode", revokeOpts.ReasonCode),
 		errs.WithKeyVal("reasonCode", revokeOpts.ReasonCode),
 		errs.WithKeyVal("reason", revokeOpts.Reason),
 		errs.WithKeyVal("reason", revokeOpts.Reason),

+ 4 - 4
authority/tls_test.go

@@ -80,7 +80,7 @@ func getDefaultSigner(a *Authority) crypto.Signer {
 	return a.x509CAService.(*softcas.SoftCAS).Signer
 	return a.x509CAService.(*softcas.SoftCAS).Signer
 }
 }
 
 
-func generateCertificate(t *testing.T, commonName string, sans []string, opts ...interface{}) *x509.Certificate {
+func generateCertificate(t *testing.T, commonName string, sans []string, opts ...any) *x509.Certificate {
 	t.Helper()
 	t.Helper()
 
 
 	priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
 	priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
@@ -187,7 +187,7 @@ func withSigner(issuer *x509.Certificate, signer crypto.Signer) signerFunc {
 	}
 	}
 }
 }
 
 
-func getCSR(t *testing.T, priv interface{}, opts ...func(*x509.CertificateRequest)) *x509.CertificateRequest {
+func getCSR(t *testing.T, priv any, opts ...func(*x509.CertificateRequest)) *x509.CertificateRequest {
 	_csr := &x509.CertificateRequest{
 	_csr := &x509.CertificateRequest{
 		Subject:  pkix.Name{CommonName: "smallstep test"},
 		Subject:  pkix.Name{CommonName: "smallstep test"},
 		DNSNames: []string{"test.smallstep.com"},
 		DNSNames: []string{"test.smallstep.com"},
@@ -2013,7 +2013,7 @@ func TestAuthority_CRL(t *testing.T) {
 
 
 			var ex []string
 			var ex []string
 
 
-			for i := 0; i < 100; i++ {
+			for i := range 100 {
 				sn := fmt.Sprintf("%v", i)
 				sn := fmt.Sprintf("%v", i)
 
 
 				cl := jose.Claims{
 				cl := jose.Claims{
@@ -2078,7 +2078,7 @@ func TestAuthority_CRL(t *testing.T) {
 			var ex []string
 			var ex []string
 			zeroReasonCode := 0
 			zeroReasonCode := 0
 
 
-			for i := 0; i < 5; i++ {
+			for i := range 5 {
 				sn := fmt.Sprintf("%v", i)
 				sn := fmt.Sprintf("%v", i)
 				cl := jose.Claims{
 				cl := jose.Claims{
 					Subject:   sn,
 					Subject:   sn,

+ 11 - 11
ca/acmeClient_test.go

@@ -25,7 +25,7 @@ import (
 func TestNewACMEClient(t *testing.T) {
 func TestNewACMEClient(t *testing.T) {
 	type test struct {
 	type test struct {
 		ops      []ClientOption
 		ops      []ClientOption
-		r1, r2   interface{}
+		r1, r2   any
 		rc1, rc2 int
 		rc1, rc2 int
 		err      error
 		err      error
 	}
 	}
@@ -159,7 +159,7 @@ func TestACMEClient_GetDirectory(t *testing.T) {
 
 
 func TestACMEClient_GetNonce(t *testing.T) {
 func TestACMEClient_GetNonce(t *testing.T) {
 	type test struct {
 	type test struct {
-		r1  interface{}
+		r1  any
 		rc1 int
 		rc1 int
 		err error
 		err error
 	}
 	}
@@ -229,7 +229,7 @@ func TestACMEClient_post(t *testing.T) {
 		payload  []byte
 		payload  []byte
 		Key      *jose.JSONWebKey
 		Key      *jose.JSONWebKey
 		ops      []withHeaderOption
 		ops      []withHeaderOption
-		r1, r2   interface{}
+		r1, r2   any
 		rc1, rc2 int
 		rc1, rc2 int
 		jwkInJWS bool
 		jwkInJWS bool
 		client   *ACMEClient
 		client   *ACMEClient
@@ -361,7 +361,7 @@ func TestACMEClient_post(t *testing.T) {
 func TestACMEClient_NewOrder(t *testing.T) {
 func TestACMEClient_NewOrder(t *testing.T) {
 	type test struct {
 	type test struct {
 		ops      []withHeaderOption
 		ops      []withHeaderOption
-		r1, r2   interface{}
+		r1, r2   any
 		rc1, rc2 int
 		rc1, rc2 int
 		err      error
 		err      error
 	}
 	}
@@ -497,7 +497,7 @@ func TestACMEClient_NewOrder(t *testing.T) {
 
 
 func TestACMEClient_GetOrder(t *testing.T) {
 func TestACMEClient_GetOrder(t *testing.T) {
 	type test struct {
 	type test struct {
-		r1, r2   interface{}
+		r1, r2   any
 		rc1, rc2 int
 		rc1, rc2 int
 		err      error
 		err      error
 	}
 	}
@@ -619,7 +619,7 @@ func TestACMEClient_GetOrder(t *testing.T) {
 
 
 func TestACMEClient_GetAuthz(t *testing.T) {
 func TestACMEClient_GetAuthz(t *testing.T) {
 	type test struct {
 	type test struct {
-		r1, r2   interface{}
+		r1, r2   any
 		rc1, rc2 int
 		rc1, rc2 int
 		err      error
 		err      error
 	}
 	}
@@ -741,7 +741,7 @@ func TestACMEClient_GetAuthz(t *testing.T) {
 
 
 func TestACMEClient_GetChallenge(t *testing.T) {
 func TestACMEClient_GetChallenge(t *testing.T) {
 	type test struct {
 	type test struct {
-		r1, r2   interface{}
+		r1, r2   any
 		rc1, rc2 int
 		rc1, rc2 int
 		err      error
 		err      error
 	}
 	}
@@ -864,7 +864,7 @@ func TestACMEClient_GetChallenge(t *testing.T) {
 
 
 func TestACMEClient_ValidateChallenge(t *testing.T) {
 func TestACMEClient_ValidateChallenge(t *testing.T) {
 	type test struct {
 	type test struct {
-		r1, r2   interface{}
+		r1, r2   any
 		rc1, rc2 int
 		rc1, rc2 int
 		err      error
 		err      error
 	}
 	}
@@ -1077,7 +1077,7 @@ func TestACMEClient_ValidateWithPayload(t *testing.T) {
 
 
 func TestACMEClient_FinalizeOrder(t *testing.T) {
 func TestACMEClient_FinalizeOrder(t *testing.T) {
 	type test struct {
 	type test struct {
-		r1, r2   interface{}
+		r1, r2   any
 		rc1, rc2 int
 		rc1, rc2 int
 		err      error
 		err      error
 	}
 	}
@@ -1203,7 +1203,7 @@ func TestACMEClient_FinalizeOrder(t *testing.T) {
 
 
 func TestACMEClient_GetAccountOrders(t *testing.T) {
 func TestACMEClient_GetAccountOrders(t *testing.T) {
 	type test struct {
 	type test struct {
-		r1, r2   interface{}
+		r1, r2   any
 		rc1, rc2 int
 		rc1, rc2 int
 		err      error
 		err      error
 		client   *ACMEClient
 		client   *ACMEClient
@@ -1336,7 +1336,7 @@ func TestACMEClient_GetAccountOrders(t *testing.T) {
 
 
 func TestACMEClient_GetCertificate(t *testing.T) {
 func TestACMEClient_GetCertificate(t *testing.T) {
 	type test struct {
 	type test struct {
-		r1, r2    interface{}
+		r1, r2    any
 		certBytes []byte
 		certBytes []byte
 		rc1, rc2  int
 		rc1, rc2  int
 		err       error
 		err       error

+ 2 - 4
ca/bootstrap_test.go

@@ -658,13 +658,11 @@ func TestBootstrapListener(t *testing.T) {
 				return
 				return
 			}
 			}
 			wg := new(sync.WaitGroup)
 			wg := new(sync.WaitGroup)
-			wg.Add(1)
-			go func() {
+			wg.Go(func() {
 				http.Serve(lis, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 				http.Serve(lis, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 					w.Write([]byte("ok"))
 					w.Write([]byte("ok"))
 				}))
 				}))
-				wg.Done()
-			}()
+			})
 			defer wg.Wait()
 			defer wg.Wait()
 			defer lis.Close()
 			defer lis.Close()
 
 

+ 1 - 1
ca/ca_test.go

@@ -41,7 +41,7 @@ func (cb *ClosingBuffer) Close() error {
 	return nil
 	return nil
 }
 }
 
 
-func getCSR(priv interface{}) (*x509.CertificateRequest, error) {
+func getCSR(priv any) (*x509.CertificateRequest, error) {
 	_csr := &x509.CertificateRequest{
 	_csr := &x509.CertificateRequest{
 		Subject:  pkix.Name{CommonName: "test.smallstep.com"},
 		Subject:  pkix.Name{CommonName: "test.smallstep.com"},
 		DNSNames: []string{"test.smallstep.com"},
 		DNSNames: []string{"test.smallstep.com"},

+ 2 - 2
ca/client.go

@@ -366,7 +366,7 @@ func WithCertificate(cert tls.Certificate) ClientOption {
 
 
 // WithAdminX5C will set the given file as the X5C certificate for use
 // WithAdminX5C will set the given file as the X5C certificate for use
 // by the client.
 // by the client.
-func WithAdminX5C(certs []*x509.Certificate, key interface{}, passwordFile string) ClientOption {
+func WithAdminX5C(certs []*x509.Certificate, key any, passwordFile string) ClientOption {
 	return func(o *clientOptions) error {
 	return func(o *clientOptions) error {
 		// Get private key from given key file
 		// Get private key from given key file
 		var (
 		var (
@@ -1566,7 +1566,7 @@ func getRootCAPath() string {
 	return filepath.Join(step.Path(), "certs", "root_ca.crt")
 	return filepath.Join(step.Path(), "certs", "root_ca.crt")
 }
 }
 
 
-func readJSON(r io.ReadCloser, v interface{}) error {
+func readJSON(r io.ReadCloser, v any) error {
 	defer r.Close()
 	defer r.Close()
 	return json.NewDecoder(r).Decode(v)
 	return json.NewDecoder(r).Decode(v)
 }
 }

+ 16 - 16
ca/client_test.go

@@ -139,7 +139,7 @@ func parseCertificateRequest(t *testing.T, csrPEM string) *x509.CertificateReque
 	return csr
 	return csr
 }
 }
 
 
-func equalJSON(t *testing.T, a, b interface{}) bool {
+func equalJSON(t *testing.T, a, b any) bool {
 	t.Helper()
 	t.Helper()
 	if reflect.DeepEqual(a, b) {
 	if reflect.DeepEqual(a, b) {
 		return true
 		return true
@@ -159,7 +159,7 @@ func TestClient_Version(t *testing.T) {
 
 
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		expectedErr  error
 		expectedErr  error
@@ -201,7 +201,7 @@ func TestClient_Health(t *testing.T) {
 
 
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		expectedErr  error
 		expectedErr  error
@@ -245,7 +245,7 @@ func TestClient_Root(t *testing.T) {
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
 		shasum       string
 		shasum       string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		expectedErr  error
 		expectedErr  error
@@ -304,7 +304,7 @@ func TestClient_Sign(t *testing.T) {
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
 		request      *api.SignRequest
 		request      *api.SignRequest
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		expectedErr  error
 		expectedErr  error
@@ -367,7 +367,7 @@ func TestClient_Revoke(t *testing.T) {
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
 		request      *api.RevokeRequest
 		request      *api.RevokeRequest
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		expectedErr  error
 		expectedErr  error
@@ -431,7 +431,7 @@ func TestClient_Renew(t *testing.T) {
 
 
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		err          error
 		err          error
@@ -485,7 +485,7 @@ func TestClient_RenewWithToken(t *testing.T) {
 
 
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		err          error
 		err          error
@@ -548,7 +548,7 @@ func TestClient_Rekey(t *testing.T) {
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
 		request      *api.RekeyRequest
 		request      *api.RekeyRequest
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		err          error
 		err          error
@@ -600,7 +600,7 @@ func TestClient_Provisioners(t *testing.T) {
 		name         string
 		name         string
 		args         []ProvisionerOption
 		args         []ProvisionerOption
 		expectedURI  string
 		expectedURI  string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 	}{
 	}{
@@ -649,7 +649,7 @@ func TestClient_ProvisionerKey(t *testing.T) {
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
 		kid          string
 		kid          string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		err          error
 		err          error
@@ -702,7 +702,7 @@ func TestClient_Roots(t *testing.T) {
 
 
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		err          error
 		err          error
@@ -752,7 +752,7 @@ func TestClient_Federation(t *testing.T) {
 
 
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		err          error
 		err          error
@@ -803,7 +803,7 @@ func TestClient_SSHRoots(t *testing.T) {
 
 
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		err          error
 		err          error
@@ -896,7 +896,7 @@ func TestClient_RootFingerprint(t *testing.T) {
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
 		server       *httptest.Server
 		server       *httptest.Server
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		want         string
 		want         string
 		wantErr      bool
 		wantErr      bool
@@ -952,7 +952,7 @@ func TestClient_SSHBastion(t *testing.T) {
 	tests := []struct {
 	tests := []struct {
 		name         string
 		name         string
 		request      *api.SSHBastionRequest
 		request      *api.SSHBastionRequest
-		response     interface{}
+		response     any
 		responseCode int
 		responseCode int
 		wantErr      bool
 		wantErr      bool
 		err          error
 		err          error

+ 14 - 14
ca/provisioner_test.go

@@ -213,7 +213,7 @@ func TestProvisioner_Token(t *testing.T) {
 				if lifetime != tt.fields.tokenLifetime {
 				if lifetime != tt.fields.tokenLifetime {
 					t.Errorf("Claims token life time = %s, want %s", lifetime, tt.fields.tokenLifetime)
 					t.Errorf("Claims token life time = %s, want %s", lifetime, tt.fields.tokenLifetime)
 				}
 				}
-				allClaims := make(map[string]interface{})
+				allClaims := make(map[string]any)
 				if err := jwt.Claims(tt.fields.jwk.Public(), &allClaims); err != nil {
 				if err := jwt.Claims(tt.fields.jwk.Public(), &allClaims); err != nil {
 					t.Error(err)
 					t.Error(err)
 					return
 					return
@@ -222,15 +222,15 @@ func TestProvisioner_Token(t *testing.T) {
 					t.Errorf("Claim sha = %s, want %s", v, sha)
 					t.Errorf("Claim sha = %s, want %s", v, sha)
 				}
 				}
 				if len(tt.args.sans) == 0 {
 				if len(tt.args.sans) == 0 {
-					if v, ok := allClaims["sans"].([]interface{}); !ok || !reflect.DeepEqual(v, []interface{}{tt.args.subject}) {
-						t.Errorf("Claim sans = %s, want %s", v, []interface{}{tt.args.subject})
+					if v, ok := allClaims["sans"].([]any); !ok || !reflect.DeepEqual(v, []any{tt.args.subject}) {
+						t.Errorf("Claim sans = %s, want %s", v, []any{tt.args.subject})
 					}
 					}
 				} else {
 				} else {
-					want := []interface{}{}
+					want := []any{}
 					for _, s := range tt.args.sans {
 					for _, s := range tt.args.sans {
 						want = append(want, s)
 						want = append(want, s)
 					}
 					}
-					if v, ok := allClaims["sans"].([]interface{}); !ok || !reflect.DeepEqual(v, want) {
+					if v, ok := allClaims["sans"].([]any); !ok || !reflect.DeepEqual(v, want) {
 						t.Errorf("Claim sans = %s, want %s", v, want)
 						t.Errorf("Claim sans = %s, want %s", v, want)
 					}
 					}
 				}
 				}
@@ -309,7 +309,7 @@ func TestProvisioner_IPv6Token(t *testing.T) {
 				if lifetime != tt.fields.tokenLifetime {
 				if lifetime != tt.fields.tokenLifetime {
 					t.Errorf("Claims token life time = %s, want %s", lifetime, tt.fields.tokenLifetime)
 					t.Errorf("Claims token life time = %s, want %s", lifetime, tt.fields.tokenLifetime)
 				}
 				}
-				allClaims := make(map[string]interface{})
+				allClaims := make(map[string]any)
 				if err := jwt.Claims(tt.fields.jwk.Public(), &allClaims); err != nil {
 				if err := jwt.Claims(tt.fields.jwk.Public(), &allClaims); err != nil {
 					t.Error(err)
 					t.Error(err)
 					return
 					return
@@ -318,15 +318,15 @@ func TestProvisioner_IPv6Token(t *testing.T) {
 					t.Errorf("Claim sha = %s, want %s", v, sha)
 					t.Errorf("Claim sha = %s, want %s", v, sha)
 				}
 				}
 				if len(tt.args.sans) == 0 {
 				if len(tt.args.sans) == 0 {
-					if v, ok := allClaims["sans"].([]interface{}); !ok || !reflect.DeepEqual(v, []interface{}{tt.args.subject}) {
-						t.Errorf("Claim sans = %s, want %s", v, []interface{}{tt.args.subject})
+					if v, ok := allClaims["sans"].([]any); !ok || !reflect.DeepEqual(v, []any{tt.args.subject}) {
+						t.Errorf("Claim sans = %s, want %s", v, []any{tt.args.subject})
 					}
 					}
 				} else {
 				} else {
-					want := []interface{}{}
+					want := []any{}
 					for _, s := range tt.args.sans {
 					for _, s := range tt.args.sans {
 						want = append(want, s)
 						want = append(want, s)
 					}
 					}
-					if v, ok := allClaims["sans"].([]interface{}); !ok || !reflect.DeepEqual(v, want) {
+					if v, ok := allClaims["sans"].([]any); !ok || !reflect.DeepEqual(v, want) {
 						t.Errorf("Claim sans = %s, want %s", v, want)
 						t.Errorf("Claim sans = %s, want %s", v, want)
 					}
 					}
 				}
 				}
@@ -407,7 +407,7 @@ func TestProvisioner_SSHToken(t *testing.T) {
 				if lifetime != tt.fields.tokenLifetime {
 				if lifetime != tt.fields.tokenLifetime {
 					t.Errorf("Claims token life time = %s, want %s", lifetime, tt.fields.tokenLifetime)
 					t.Errorf("Claims token life time = %s, want %s", lifetime, tt.fields.tokenLifetime)
 				}
 				}
-				allClaims := make(map[string]interface{})
+				allClaims := make(map[string]any)
 				if err := jwt.Claims(tt.fields.jwk.Public(), &allClaims); err != nil {
 				if err := jwt.Claims(tt.fields.jwk.Public(), &allClaims); err != nil {
 					t.Error(err)
 					t.Error(err)
 					return
 					return
@@ -416,12 +416,12 @@ func TestProvisioner_SSHToken(t *testing.T) {
 					t.Errorf("Claim sha = %s, want %s", v, sha)
 					t.Errorf("Claim sha = %s, want %s", v, sha)
 				}
 				}
 
 
-				principals := make([]interface{}, len(tt.args.principals))
+				principals := make([]any, len(tt.args.principals))
 				for i, p := range tt.args.principals {
 				for i, p := range tt.args.principals {
 					principals[i] = p
 					principals[i] = p
 				}
 				}
-				want := map[string]interface{}{
-					"ssh": map[string]interface{}{
+				want := map[string]any{
+					"ssh": map[string]any{
 						"certType":    tt.args.certType,
 						"certType":    tt.args.certType,
 						"keyID":       tt.args.keyID,
 						"keyID":       tt.args.keyID,
 						"principals":  principals,
 						"principals":  principals,

+ 4 - 39
ca/tls.go

@@ -3,12 +3,8 @@ package ca
 import (
 import (
 	"context"
 	"context"
 	"crypto"
 	"crypto"
-	"crypto/ecdsa"
-	"crypto/ed25519"
-	"crypto/rsa"
 	"crypto/tls"
 	"crypto/tls"
 	"crypto/x509"
 	"crypto/x509"
-	"encoding/pem"
 	"net"
 	"net"
 	"net/http"
 	"net/http"
 	"os"
 	"os"
@@ -18,6 +14,7 @@ import (
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
 	"github.com/smallstep/certificates/api"
 	"github.com/smallstep/certificates/api"
 	"github.com/smallstep/certificates/ca/identity"
 	"github.com/smallstep/certificates/ca/identity"
+	"github.com/smallstep/certificates/internal/cryptoutil"
 )
 )
 
 
 // mTLSDialContext will hold the dial context function to use in
 // mTLSDialContext will hold the dial context function to use in
@@ -264,15 +261,15 @@ func RootCertificate(sign *api.SignResponse) (*x509.Certificate, error) {
 // TLSCertificate creates a new TLS certificate from the sign response and the
 // TLSCertificate creates a new TLS certificate from the sign response and the
 // private key used.
 // private key used.
 func TLSCertificate(sign *api.SignResponse, pk crypto.PrivateKey) (*tls.Certificate, error) {
 func TLSCertificate(sign *api.SignResponse, pk crypto.PrivateKey) (*tls.Certificate, error) {
-	certPEM, err := getPEM(sign.ServerPEM)
+	certPEM, err := cryptoutil.PEMEncode(sign.ServerPEM.Certificate)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	caPEM, err := getPEM(sign.CaPEM)
+	caPEM, err := cryptoutil.PEMEncode(sign.CaPEM.Certificate)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	keyPEM, err := getPEM(pk)
+	keyPEM, err := cryptoutil.PEMEncode(pk)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -342,38 +339,6 @@ func getDefaultTransport(tlsConfig *tls.Config) *http.Transport {
 	}
 	}
 }
 }
 
 
-func getPEM(i interface{}) ([]byte, error) {
-	block := new(pem.Block)
-	switch i := i.(type) {
-	case api.Certificate:
-		block.Type = "CERTIFICATE"
-		block.Bytes = i.Raw
-	case *x509.Certificate:
-		block.Type = "CERTIFICATE"
-		block.Bytes = i.Raw
-	case *rsa.PrivateKey:
-		block.Type = "RSA PRIVATE KEY"
-		block.Bytes = x509.MarshalPKCS1PrivateKey(i)
-	case *ecdsa.PrivateKey:
-		var err error
-		block.Type = "EC PRIVATE KEY"
-		block.Bytes, err = x509.MarshalECPrivateKey(i)
-		if err != nil {
-			return nil, errors.Wrap(err, "error marshaling private key")
-		}
-	case ed25519.PrivateKey:
-		var err error
-		block.Type = "PRIVATE KEY"
-		block.Bytes, err = x509.MarshalPKCS8PrivateKey(i)
-		if err != nil {
-			return nil, errors.Wrap(err, "error marshaling private key")
-		}
-	default:
-		return nil, errors.Errorf("unsupported key type %T", i)
-	}
-	return pem.EncodeToMemory(block), nil
-}
-
 func getRenewFunc(ctx *TLSOptionCtx, client *Client, tr http.RoundTripper, pk crypto.PrivateKey) RenewFunc {
 func getRenewFunc(ctx *TLSOptionCtx, client *Client, tr http.RoundTripper, pk crypto.PrivateKey) RenewFunc {
 	return func() (*tls.Certificate, error) {
 	return func() (*tls.Certificate, error) {
 		// Close connections in keep-alive state
 		// Close connections in keep-alive state

+ 1 - 1
cas/softcas/softcas_test.go

@@ -199,7 +199,7 @@ func setTeeReader(t *testing.T, w *bytes.Buffer) {
 }
 }
 
 
 func TestNew(t *testing.T) {
 func TestNew(t *testing.T) {
-	assertEqual := func(x, y interface{}) bool {
+	assertEqual := func(x, y any) bool {
 		return reflect.DeepEqual(x, y) || fmt.Sprintf("%#v", x) == fmt.Sprintf("%#v", y)
 		return reflect.DeepEqual(x, y) || fmt.Sprintf("%#v", x) == fmt.Sprintf("%#v", y)
 	}
 	}
 
 

+ 3 - 3
cas/stepcas/jwk_issuer.go

@@ -83,13 +83,13 @@ func (i *jwkIssuer) createToken(aud, sub string, sans []string, info *raInfo) (s
 	claims := defaultClaims(i.issuer, sub, aud, id)
 	claims := defaultClaims(i.issuer, sub, aud, id)
 	builder := jose.Signed(i.signer).Claims(claims)
 	builder := jose.Signed(i.signer).Claims(claims)
 	if len(sans) > 0 {
 	if len(sans) > 0 {
-		builder = builder.Claims(map[string]interface{}{
+		builder = builder.Claims(map[string]any{
 			"sans": sans,
 			"sans": sans,
 		})
 		})
 	}
 	}
 	if info != nil {
 	if info != nil {
-		builder = builder.Claims(map[string]interface{}{
-			"step": map[string]interface{}{
+		builder = builder.Claims(map[string]any{
+			"step": map[string]any{
 				"ra": info,
 				"ra": info,
 			},
 			},
 		})
 		})

+ 2 - 2
cas/stepcas/stepcas_test.go

@@ -123,10 +123,10 @@ func mustEncryptKey(filename string, key crypto.Signer) {
 func testCAHelper(t *testing.T) (*url.URL, *ca.Client) {
 func testCAHelper(t *testing.T) (*url.URL, *ca.Client) {
 	t.Helper()
 	t.Helper()
 
 
-	writeJSON := func(w http.ResponseWriter, v interface{}) {
+	writeJSON := func(w http.ResponseWriter, v any) {
 		_ = json.NewEncoder(w).Encode(v)
 		_ = json.NewEncoder(w).Encode(v)
 	}
 	}
-	parseJSON := func(r *http.Request, v interface{}) {
+	parseJSON := func(r *http.Request, v any) {
 		_ = json.NewDecoder(r.Body).Decode(v)
 		_ = json.NewDecoder(r.Body).Decode(v)
 	}
 	}
 	srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 	srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

+ 3 - 3
cas/stepcas/x5c_issuer.go

@@ -90,13 +90,13 @@ func (i *x5cIssuer) createToken(aud, sub string, sans []string, info *raInfo) (s
 	claims := defaultClaims(i.issuer, sub, aud, id)
 	claims := defaultClaims(i.issuer, sub, aud, id)
 	builder := jose.Signed(signer).Claims(claims)
 	builder := jose.Signed(signer).Claims(claims)
 	if len(sans) > 0 {
 	if len(sans) > 0 {
-		builder = builder.Claims(map[string]interface{}{
+		builder = builder.Claims(map[string]any{
 			"sans": sans,
 			"sans": sans,
 		})
 		})
 	}
 	}
 	if info != nil {
 	if info != nil {
-		builder = builder.Claims(map[string]interface{}{
-			"step": map[string]interface{}{
+		builder = builder.Claims(map[string]any{
+			"step": map[string]any{
 				"ra": info,
 				"ra": info,
 			},
 			},
 		})
 		})

+ 2 - 2
cas/stepcas/x5c_issuer_test.go

@@ -229,7 +229,7 @@ func Test_x5cIssuer_Lifetime(t *testing.T) {
 }
 }
 
 
 func Test_newJoseSigner(t *testing.T) {
 func Test_newJoseSigner(t *testing.T) {
-	mustSigner := func(args ...interface{}) crypto.Signer {
+	mustSigner := func(args ...any) crypto.Signer {
 		if err := args[len(args)-1]; err != nil {
 		if err := args[len(args)-1]; err != nil {
 			t.Fatal(err)
 			t.Fatal(err)
 		}
 		}
@@ -260,7 +260,7 @@ func Test_newJoseSigner(t *testing.T) {
 		wantErr bool
 		wantErr bool
 	}{
 	}{
 		{"p256", args{p256, nil}, []jose.Header{{Algorithm: "ES256"}}, false},
 		{"p256", args{p256, nil}, []jose.Header{{Algorithm: "ES256"}}, false},
-		{"p384", args{p384, new(jose.SignerOptions).WithType("JWT")}, []jose.Header{{Algorithm: "ES384", ExtraHeaders: map[jose.HeaderKey]interface{}{"typ": "JWT"}}}, false},
+		{"p384", args{p384, new(jose.SignerOptions).WithType("JWT")}, []jose.Header{{Algorithm: "ES384", ExtraHeaders: map[jose.HeaderKey]any{"typ": "JWT"}}}, false},
 		{"p521", args{p521, new(jose.SignerOptions).WithHeader("kid", "the-kid")}, []jose.Header{{Algorithm: "ES512", KeyID: "the-kid"}}, false},
 		{"p521", args{p521, new(jose.SignerOptions).WithHeader("kid", "the-kid")}, []jose.Header{{Algorithm: "ES512", KeyID: "the-kid"}}, false},
 		{"ed25519", args{edKey, nil}, []jose.Header{{Algorithm: "EdDSA"}}, false},
 		{"ed25519", args{edKey, nil}, []jose.Header{{Algorithm: "EdDSA"}}, false},
 		{"rsa", args{rsaKey, nil}, []jose.Header{{Algorithm: "RS256"}}, false},
 		{"rsa", args{rsaKey, nil}, []jose.Header{{Algorithm: "RS256"}}, false},

+ 2 - 2
cas/vaultcas/vaultcas.go

@@ -195,7 +195,7 @@ func (v *VaultCAS) RevokeCertificate(req *apiv1.RevokeCertificateRequest) (*apiv
 		sn = req.Certificate.SerialNumber
 		sn = req.Certificate.SerialNumber
 	}
 	}
 
 
-	vaultReq := map[string]interface{}{
+	vaultReq := map[string]any{
 		"serial_number": formatSerialNumber(sn),
 		"serial_number": formatSerialNumber(sn),
 	}
 	}
 	_, err := v.client.Logical().Write(v.config.PKIMountPath+"/revoke/", vaultReq)
 	_, err := v.client.Logical().Write(v.config.PKIMountPath+"/revoke/", vaultReq)
@@ -223,7 +223,7 @@ func (v *VaultCAS) createCertificate(cr *x509.CertificateRequest, lifetime time.
 		return nil, nil, fmt.Errorf("unsupported public key algorithm %v", cr.PublicKeyAlgorithm)
 		return nil, nil, fmt.Errorf("unsupported public key algorithm %v", cr.PublicKeyAlgorithm)
 	}
 	}
 
 
-	vaultReq := map[string]interface{}{
+	vaultReq := map[string]any{
 		"csr": string(pem.EncodeToMemory(&pem.Block{
 		"csr": string(pem.EncodeToMemory(&pem.Block{
 			Type:  "CERTIFICATE REQUEST",
 			Type:  "CERTIFICATE REQUEST",
 			Bytes: cr.Raw,
 			Bytes: cr.Raw,

+ 5 - 5
cas/vaultcas/vaultcas_test.go

@@ -92,7 +92,7 @@ func mustParseCertificateRequest(t *testing.T, pemData string) *x509.Certificate
 func testCAHelper(t *testing.T) (*url.URL, *vault.Client) {
 func testCAHelper(t *testing.T) (*url.URL, *vault.Client) {
 	t.Helper()
 	t.Helper()
 
 
-	writeJSON := func(w http.ResponseWriter, v interface{}) {
+	writeJSON := func(w http.ResponseWriter, v any) {
 		_ = json.NewEncoder(w).Encode(v)
 		_ = json.NewEncoder(w).Encode(v)
 	}
 	}
 
 
@@ -107,22 +107,22 @@ func testCAHelper(t *testing.T) (*url.URL, *vault.Client) {
 				}`)
 				}`)
 		case "/v1/pki/sign/ec":
 		case "/v1/pki/sign/ec":
 			w.WriteHeader(http.StatusOK)
 			w.WriteHeader(http.StatusOK)
-			cert := map[string]interface{}{"data": map[string]interface{}{"certificate": testCertificateSigned + "\n" + testRootCertificate}}
+			cert := map[string]any{"data": map[string]any{"certificate": testCertificateSigned + "\n" + testRootCertificate}}
 			writeJSON(w, cert)
 			writeJSON(w, cert)
 			return
 			return
 		case "/v1/pki/sign/rsa":
 		case "/v1/pki/sign/rsa":
 			w.WriteHeader(http.StatusOK)
 			w.WriteHeader(http.StatusOK)
-			cert := map[string]interface{}{"data": map[string]interface{}{"certificate": testCertificateSigned + "\n" + testRootCertificate}}
+			cert := map[string]any{"data": map[string]any{"certificate": testCertificateSigned + "\n" + testRootCertificate}}
 			writeJSON(w, cert)
 			writeJSON(w, cert)
 			return
 			return
 		case "/v1/pki/sign/ed25519":
 		case "/v1/pki/sign/ed25519":
 			w.WriteHeader(http.StatusOK)
 			w.WriteHeader(http.StatusOK)
-			cert := map[string]interface{}{"data": map[string]interface{}{"certificate": testCertificateSigned + "\n" + testRootCertificate}}
+			cert := map[string]any{"data": map[string]any{"certificate": testCertificateSigned + "\n" + testRootCertificate}}
 			writeJSON(w, cert)
 			writeJSON(w, cert)
 			return
 			return
 		case "/v1/pki/cert/ca_chain":
 		case "/v1/pki/cert/ca_chain":
 			w.WriteHeader(http.StatusOK)
 			w.WriteHeader(http.StatusOK)
-			cert := map[string]interface{}{"data": map[string]interface{}{"certificate": testCertificateSigned + "\n" + testRootCertificate}}
+			cert := map[string]any{"data": map[string]any{"certificate": testCertificateSigned + "\n" + testRootCertificate}}
 			writeJSON(w, cert)
 			writeJSON(w, cert)
 			return
 			return
 		case "/v1/pki/revoke":
 		case "/v1/pki/revoke":

+ 1 - 1
cmd/step-ca/main.go

@@ -217,7 +217,7 @@ $ step-ca --context=mybiz --password-file ./password.txt
 
 
 func flagValue(f cli.Flag) reflect.Value {
 func flagValue(f cli.Flag) reflect.Value {
 	fv := reflect.ValueOf(f)
 	fv := reflect.ValueOf(f)
-	for fv.Kind() == reflect.Ptr {
+	for fv.Kind() == reflect.Pointer {
 		fv = reflect.Indirect(fv)
 		fv = reflect.Indirect(fv)
 	}
 	}
 	return fv
 	return fv

+ 1 - 1
commands/onboard.go

@@ -224,7 +224,7 @@ func onboardPKI(cfg onboardingConfiguration) (*config.Config, string, error) {
 	return caConfig, p.GetRootFingerprint(), nil
 	return caConfig, p.GetRootFingerprint(), nil
 }
 }
 
 
-func readJSON(r io.ReadCloser, v interface{}) error {
+func readJSON(r io.ReadCloser, v any) error {
 	defer r.Close()
 	defer r.Close()
 	return json.NewDecoder(r).Decode(v)
 	return json.NewDecoder(r).Decode(v)
 }
 }

+ 2 - 2
db/db.go

@@ -489,7 +489,7 @@ func (db *DB) Shutdown() error {
 // MockAuthDB mocks the AuthDB interface. //
 // MockAuthDB mocks the AuthDB interface. //
 type MockAuthDB struct {
 type MockAuthDB struct {
 	Err                     error
 	Err                     error
-	Ret1                    interface{}
+	Ret1                    any
 	MIsRevoked              func(string) (bool, error)
 	MIsRevoked              func(string) (bool, error)
 	MIsSSHRevoked           func(string) (bool, error)
 	MIsSSHRevoked           func(string) (bool, error)
 	MRevoke                 func(rci *RevokedCertificateInfo) error
 	MRevoke                 func(rci *RevokedCertificateInfo) error
@@ -633,7 +633,7 @@ func (m *MockAuthDB) Shutdown() error {
 // MockNoSQLDB //
 // MockNoSQLDB //
 type MockNoSQLDB struct {
 type MockNoSQLDB struct {
 	Err          error
 	Err          error
-	Ret1, Ret2   interface{}
+	Ret1, Ret2   any
 	MGet         func(bucket, key []byte) ([]byte, error)
 	MGet         func(bucket, key []byte) ([]byte, error)
 	MSet         func(bucket, key, value []byte) error
 	MSet         func(bucket, key, value []byte) error
 	MOpen        func(dataSourceName string, opt ...database.Option) error
 	MOpen        func(dataSourceName string, opt ...database.Option) error

+ 20 - 20
errs/error.go

@@ -30,7 +30,7 @@ func withDefaultMessage(message string) Option {
 
 
 // withFormattedMessage returns an Option that modifies the error by overwriting
 // withFormattedMessage returns an Option that modifies the error by overwriting
 // the formatted message only if it is empty.
 // the formatted message only if it is empty.
-func withFormattedMessage(format string, args ...interface{}) Option {
+func withFormattedMessage(format string, args ...any) Option {
 	return func(e *Error) error {
 	return func(e *Error) error {
 		if e.Msg != "" {
 		if e.Msg != "" {
 			return e
 			return e
@@ -42,7 +42,7 @@ func withFormattedMessage(format string, args ...interface{}) Option {
 
 
 // WithMessage returns an Option that modifies the error by overwriting the
 // WithMessage returns an Option that modifies the error by overwriting the
 // message with the formatted string.
 // message with the formatted string.
-func WithMessage(format string, args ...interface{}) Option {
+func WithMessage(format string, args ...any) Option {
 	return func(e *Error) error {
 	return func(e *Error) error {
 		e.Msg = fmt.Sprintf(format, args...)
 		e.Msg = fmt.Sprintf(format, args...)
 		return e
 		return e
@@ -60,10 +60,10 @@ func WithErrorMessage() Option {
 
 
 // WithKeyVal returns an Option that adds the given key-value pair to the
 // WithKeyVal returns an Option that adds the given key-value pair to the
 // Error details. This is helpful for debugging errors.
 // Error details. This is helpful for debugging errors.
-func WithKeyVal(key string, val interface{}) Option {
+func WithKeyVal(key string, val any) Option {
 	return func(e *Error) error {
 	return func(e *Error) error {
 		if e.Details == nil {
 		if e.Details == nil {
-			e.Details = make(map[string]interface{})
+			e.Details = make(map[string]any)
 		}
 		}
 		e.Details[key] = val
 		e.Details[key] = val
 		return e
 		return e
@@ -75,7 +75,7 @@ type Error struct {
 	Status    int
 	Status    int
 	Err       error
 	Err       error
 	Msg       string
 	Msg       string
-	Details   map[string]interface{}
+	Details   map[string]any
 	RequestID string `json:"-"`
 	RequestID string `json:"-"`
 }
 }
 
 
@@ -116,7 +116,7 @@ func (e *Error) Message() string {
 
 
 // Wrap returns an error annotating err with a stack trace at the point Wrap is
 // Wrap returns an error annotating err with a stack trace at the point Wrap is
 // called, and the supplied message. If err is nil, Wrap returns nil.
 // called, and the supplied message. If err is nil, Wrap returns nil.
-func Wrap(status int, e error, m string, args ...interface{}) error {
+func Wrap(status int, e error, m string, args ...any) error {
 	if e == nil {
 	if e == nil {
 		return nil
 		return nil
 	}
 	}
@@ -133,7 +133,7 @@ func Wrap(status int, e error, m string, args ...interface{}) error {
 
 
 // Wrapf returns an error annotating err with a stack trace at the point Wrap is
 // Wrapf returns an error annotating err with a stack trace at the point Wrap is
 // called, and the supplied message. If err is nil, Wrap returns nil.
 // called, and the supplied message. If err is nil, Wrap returns nil.
-func Wrapf(status int, e error, format string, args ...interface{}) error {
+func Wrapf(status int, e error, format string, args ...any) error {
 	if e == nil {
 	if e == nil {
 		return nil
 		return nil
 	}
 	}
@@ -264,7 +264,7 @@ func formatMessage(status int, msg string) string {
 
 
 // splitOptionArgs splits the variadic length args into string formatting args
 // splitOptionArgs splits the variadic length args into string formatting args
 // and Option(s) to apply to an Error.
 // and Option(s) to apply to an Error.
-func splitOptionArgs(args []interface{}) ([]interface{}, []Option) {
+func splitOptionArgs(args []any) ([]any, []Option) {
 	indexOptionStart := -1
 	indexOptionStart := -1
 	for i, a := range args {
 	for i, a := range args {
 		if _, ok := a.(Option); ok {
 		if _, ok := a.(Option); ok {
@@ -287,7 +287,7 @@ func splitOptionArgs(args []interface{}) ([]interface{}, []Option) {
 }
 }
 
 
 // New creates a new http error with the given status and message.
 // New creates a new http error with the given status and message.
-func New(status int, format string, args ...interface{}) error {
+func New(status int, format string, args ...any) error {
 	msg := fmt.Sprintf(format, args...)
 	msg := fmt.Sprintf(format, args...)
 	return &Error{
 	return &Error{
 		Status: status,
 		Status: status,
@@ -297,7 +297,7 @@ func New(status int, format string, args ...interface{}) error {
 }
 }
 
 
 // NewError creates a new http error with the given error and message.
 // NewError creates a new http error with the given error and message.
-func NewError(status int, err error, format string, args ...interface{}) error {
+func NewError(status int, err error, format string, args ...any) error {
 	var e *Error
 	var e *Error
 	if errors.As(err, &e) {
 	if errors.As(err, &e) {
 		return err
 		return err
@@ -333,7 +333,7 @@ func NewErr(status int, err error, opts ...Option) error {
 }
 }
 
 
 // Errorf creates a new error using the given format and status code.
 // Errorf creates a new error using the given format and status code.
-func Errorf(code int, format string, args ...interface{}) error {
+func Errorf(code int, format string, args ...any) error {
 	as, opts := splitOptionArgs(args)
 	as, opts := splitOptionArgs(args)
 	opts = append(opts, withDefaultMessage(defaultMessage(code)))
 	opts = append(opts, withDefaultMessage(defaultMessage(code)))
 	e := &Error{Status: code, Err: fmt.Errorf(format, as...)}
 	e := &Error{Status: code, Err: fmt.Errorf(format, as...)}
@@ -345,7 +345,7 @@ func Errorf(code int, format string, args ...interface{}) error {
 
 
 // ApplyOptions applies the given options to the error if is the type *Error.
 // ApplyOptions applies the given options to the error if is the type *Error.
 // TODO(mariano): try to get rid of this.
 // TODO(mariano): try to get rid of this.
-func ApplyOptions(err error, opts ...interface{}) error {
+func ApplyOptions(err error, opts ...any) error {
 	var e *Error
 	var e *Error
 	if errors.As(err, &e) {
 	if errors.As(err, &e) {
 		_, o := splitOptionArgs(opts)
 		_, o := splitOptionArgs(opts)
@@ -357,7 +357,7 @@ func ApplyOptions(err error, opts ...interface{}) error {
 }
 }
 
 
 // InternalServer creates a 500 error with the given format and arguments.
 // InternalServer creates a 500 error with the given format and arguments.
-func InternalServer(format string, args ...interface{}) error {
+func InternalServer(format string, args ...any) error {
 	args = append(args, withDefaultMessage(InternalServerErrorDefaultMsg))
 	args = append(args, withDefaultMessage(InternalServerErrorDefaultMsg))
 	return Errorf(http.StatusInternalServerError, format, args...)
 	return Errorf(http.StatusInternalServerError, format, args...)
 }
 }
@@ -369,7 +369,7 @@ func InternalServerErr(err error, opts ...Option) error {
 }
 }
 
 
 // NotImplemented creates a 501 error with the given format and arguments.
 // NotImplemented creates a 501 error with the given format and arguments.
-func NotImplemented(format string, args ...interface{}) error {
+func NotImplemented(format string, args ...any) error {
 	args = append(args, withDefaultMessage(NotImplementedDefaultMsg))
 	args = append(args, withDefaultMessage(NotImplementedDefaultMsg))
 	return Errorf(http.StatusNotImplemented, format, args...)
 	return Errorf(http.StatusNotImplemented, format, args...)
 }
 }
@@ -381,17 +381,17 @@ func NotImplementedErr(err error, opts ...Option) error {
 }
 }
 
 
 // BadRequest creates a 400 error with the given format and arguments.
 // BadRequest creates a 400 error with the given format and arguments.
-func BadRequest(format string, args ...interface{}) error {
+func BadRequest(format string, args ...any) error {
 	return New(http.StatusBadRequest, format, args...)
 	return New(http.StatusBadRequest, format, args...)
 }
 }
 
 
 // BadRequestErr returns an 400 error with the given error.
 // BadRequestErr returns an 400 error with the given error.
-func BadRequestErr(err error, format string, args ...interface{}) error {
+func BadRequestErr(err error, format string, args ...any) error {
 	return NewError(http.StatusBadRequest, err, format, args...)
 	return NewError(http.StatusBadRequest, err, format, args...)
 }
 }
 
 
 // Unauthorized creates a 401 error with the given format and arguments.
 // Unauthorized creates a 401 error with the given format and arguments.
-func Unauthorized(format string, args ...interface{}) error {
+func Unauthorized(format string, args ...any) error {
 	args = append(args, withDefaultMessage(UnauthorizedDefaultMsg))
 	args = append(args, withDefaultMessage(UnauthorizedDefaultMsg))
 	return Errorf(http.StatusUnauthorized, format, args...)
 	return Errorf(http.StatusUnauthorized, format, args...)
 }
 }
@@ -403,17 +403,17 @@ func UnauthorizedErr(err error, opts ...Option) error {
 }
 }
 
 
 // Forbidden creates a 403 error with the given format and arguments.
 // Forbidden creates a 403 error with the given format and arguments.
-func Forbidden(format string, args ...interface{}) error {
+func Forbidden(format string, args ...any) error {
 	return New(http.StatusForbidden, format, args...)
 	return New(http.StatusForbidden, format, args...)
 }
 }
 
 
 // ForbiddenErr returns an 403 error with the given error.
 // ForbiddenErr returns an 403 error with the given error.
-func ForbiddenErr(err error, format string, args ...interface{}) error {
+func ForbiddenErr(err error, format string, args ...any) error {
 	return NewError(http.StatusForbidden, err, format, args...)
 	return NewError(http.StatusForbidden, err, format, args...)
 }
 }
 
 
 // NotFound creates a 404 error with the given format and arguments.
 // NotFound creates a 404 error with the given format and arguments.
-func NotFound(format string, args ...interface{}) error {
+func NotFound(format string, args ...any) error {
 	args = append(args, withDefaultMessage(NotFoundDefaultMsg))
 	args = append(args, withDefaultMessage(NotFoundDefaultMsg))
 	return Errorf(http.StatusNotFound, format, args...)
 	return Errorf(http.StatusNotFound, format, args...)
 }
 }

+ 1 - 1
errs/errors_test.go

@@ -190,7 +190,7 @@ func TestErrorf(t *testing.T) {
 			Status:  500,
 			Status:  500,
 			Err:     errors.New("test error string"),
 			Err:     errors.New("test error string"),
 			Msg:     InternalServerErrorDefaultMsg,
 			Msg:     InternalServerErrorDefaultMsg,
-			Details: map[string]interface{}{"foo": 1, "bar": "zar"},
+			Details: map[string]any{"foo": 1, "bar": "zar"},
 		}},
 		}},
 		{"withDefaultMessage", 501, "test error string", []any{withDefaultMessage("some message")}, &Error{
 		{"withDefaultMessage", 501, "test error string", []any{withDefaultMessage("some message")}, &Error{
 			Status: 501,
 			Status: 501,

+ 1 - 1
examples/basic-client/client.go

@@ -13,7 +13,7 @@ import (
 	"github.com/smallstep/certificates/ca"
 	"github.com/smallstep/certificates/ca"
 )
 )
 
 
-func printResponse(name string, v interface{}) {
+func printResponse(name string, v any) {
 	b, err := json.MarshalIndent(v, "", "  ")
 	b, err := json.MarshalIndent(v, "", "  ")
 	if err != nil {
 	if err != nil {
 		panic(err)
 		panic(err)

+ 30 - 30
go.mod

@@ -1,6 +1,6 @@
 module github.com/smallstep/certificates
 module github.com/smallstep/certificates
 
 
-go 1.25.8
+go 1.26.0
 
 
 require (
 require (
 	cloud.google.com/go/longrunning v1.2.0
 	cloud.google.com/go/longrunning v1.2.0
@@ -17,7 +17,7 @@ require (
 	github.com/google/go-cmp v0.7.0
 	github.com/google/go-cmp v0.7.0
 	github.com/google/go-tpm v0.9.8
 	github.com/google/go-tpm v0.9.8
 	github.com/google/uuid v1.6.0
 	github.com/google/uuid v1.6.0
-	github.com/googleapis/gax-go/v2 v2.23.0
+	github.com/googleapis/gax-go/v2 v2.24.0
 	github.com/hashicorp/vault/api v1.23.0
 	github.com/hashicorp/vault/api v1.23.0
 	github.com/hashicorp/vault/api/auth/approle v0.12.0
 	github.com/hashicorp/vault/api/auth/approle v0.12.0
 	github.com/hashicorp/vault/api/auth/aws v0.12.0
 	github.com/hashicorp/vault/api/auth/aws v0.12.0
@@ -38,52 +38,52 @@ require (
 	github.com/smallstep/scep v0.0.0-20250318231241-a25cabb69492
 	github.com/smallstep/scep v0.0.0-20250318231241-a25cabb69492
 	github.com/stretchr/testify v1.12.1
 	github.com/stretchr/testify v1.12.1
 	github.com/urfave/cli v1.22.17
 	github.com/urfave/cli v1.22.17
-	go.step.sm/crypto v0.89.0
+	go.step.sm/crypto v0.90.0-rc1
 	go.uber.org/mock v0.6.0
 	go.uber.org/mock v0.6.0
-	golang.org/x/crypto v0.55.0
+	golang.org/x/crypto v0.56.0
 	golang.org/x/net v0.58.0
 	golang.org/x/net v0.58.0
 	golang.org/x/sync v0.22.0
 	golang.org/x/sync v0.22.0
-	google.golang.org/api v0.292.0
-	google.golang.org/grpc v1.83.1
+	google.golang.org/api v0.293.0
+	google.golang.org/grpc v1.83.2
 	google.golang.org/protobuf v1.36.12
 	google.golang.org/protobuf v1.36.12
 )
 )
 
 
 require (
 require (
 	cloud.google.com/go v0.123.0 // indirect
 	cloud.google.com/go v0.123.0 // indirect
-	cloud.google.com/go/auth v0.22.0 // indirect
+	cloud.google.com/go/auth v0.23.0 // indirect
 	cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
 	cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
 	cloud.google.com/go/compute/metadata v0.9.0 // indirect
 	cloud.google.com/go/compute/metadata v0.9.0 // indirect
-	cloud.google.com/go/iam v1.11.0 // indirect
+	cloud.google.com/go/iam v1.12.0 // indirect
 	cloud.google.com/go/kms v1.33.0 // indirect
 	cloud.google.com/go/kms v1.33.0 // indirect
 	dario.cat/mergo v1.0.2 // indirect
 	dario.cat/mergo v1.0.2 // indirect
 	filippo.io/bigmod v0.1.0 // indirect
 	filippo.io/bigmod v0.1.0 // indirect
 	filippo.io/edwards25519 v1.2.0 // indirect
 	filippo.io/edwards25519 v1.2.0 // indirect
 	github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
 	github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
-	github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0 // indirect
-	github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0 // indirect
+	github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.1 // indirect
+	github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1 // indirect
 	github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect
 	github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect
 	github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 // indirect
 	github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 // indirect
 	github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect
 	github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect
-	github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 // indirect
+	github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0 // indirect
 	github.com/Masterminds/goutils v1.1.1 // indirect
 	github.com/Masterminds/goutils v1.1.1 // indirect
 	github.com/Masterminds/semver/v3 v3.3.1 // indirect
 	github.com/Masterminds/semver/v3 v3.3.1 // indirect
 	github.com/ThalesGroup/crypto11 v1.6.2 // indirect
 	github.com/ThalesGroup/crypto11 v1.6.2 // indirect
 	github.com/aws/aws-sdk-go v1.55.7 // indirect
 	github.com/aws/aws-sdk-go v1.55.7 // indirect
-	github.com/aws/aws-sdk-go-v2 v1.43.4 // indirect
-	github.com/aws/aws-sdk-go-v2/config v1.32.35 // indirect
-	github.com/aws/aws-sdk-go-v2/credentials v1.19.34 // indirect
-	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.35 // indirect
-	github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.35 // indirect
-	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.35 // indirect
-	github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.36 // indirect
-	github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.15 // indirect
-	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.35 // indirect
-	github.com/aws/aws-sdk-go-v2/service/kms v1.55.4 // indirect
-	github.com/aws/aws-sdk-go-v2/service/signin v1.5.4 // indirect
-	github.com/aws/aws-sdk-go-v2/service/sso v1.33.4 // indirect
-	github.com/aws/aws-sdk-go-v2/service/ssooidc v1.38.4 // indirect
-	github.com/aws/aws-sdk-go-v2/service/sts v1.45.4 // indirect
-	github.com/aws/smithy-go v1.27.6 // indirect
+	github.com/aws/aws-sdk-go-v2 v1.45.1 // indirect
+	github.com/aws/aws-sdk-go-v2/config v1.33.1 // indirect
+	github.com/aws/aws-sdk-go-v2/credentials v1.20.1 // indirect
+	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.1 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.1 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.1 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.1 // indirect
+	github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19 // indirect
+	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.1 // indirect
+	github.com/aws/aws-sdk-go-v2/service/kms v1.57.1 // indirect
+	github.com/aws/aws-sdk-go-v2/service/signin v1.7.1 // indirect
+	github.com/aws/aws-sdk-go-v2/service/sso v1.35.1 // indirect
+	github.com/aws/aws-sdk-go-v2/service/ssooidc v1.40.1 // indirect
+	github.com/aws/aws-sdk-go-v2/service/sts v1.47.1 // indirect
+	github.com/aws/smithy-go v1.28.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cenkalti/backoff/v4 v4.3.0 // indirect
 	github.com/cenkalti/backoff/v4 v4.3.0 // indirect
 	github.com/cespare/xxhash v1.1.0 // indirect
 	github.com/cespare/xxhash v1.1.0 // indirect
@@ -109,7 +109,7 @@ require (
 	github.com/google/go-tpm-tools v0.4.9 // indirect
 	github.com/google/go-tpm-tools v0.4.9 // indirect
 	github.com/google/go-tspi v0.3.0 // indirect
 	github.com/google/go-tspi v0.3.0 // indirect
 	github.com/google/s2a-go v0.1.9 // indirect
 	github.com/google/s2a-go v0.1.9 // indirect
-	github.com/googleapis/enterprise-certificate-proxy v0.3.19 // indirect
+	github.com/googleapis/enterprise-certificate-proxy v0.3.20 // indirect
 	github.com/hashicorp/errwrap v1.1.0 // indirect
 	github.com/hashicorp/errwrap v1.1.0 // indirect
 	github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
 	github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
 	github.com/hashicorp/go-hclog v1.6.3 // indirect
 	github.com/hashicorp/go-hclog v1.6.3 // indirect
@@ -168,8 +168,8 @@ require (
 	golang.org/x/text v0.41.0 // indirect
 	golang.org/x/text v0.41.0 // indirect
 	golang.org/x/time v0.15.0 // indirect
 	golang.org/x/time v0.15.0 // indirect
 	golang.org/x/tools v0.48.0 // indirect
 	golang.org/x/tools v0.48.0 // indirect
-	google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 // indirect
-	google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7 // indirect
-	google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d // indirect
+	google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d // indirect
+	google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d // indirect
+	google.golang.org/genproto/googleapis/rpc v0.0.0-20260807164820-c8921c73eeea // indirect
 	google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 // indirect
 	google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 // indirect
 )
 )

+ 58 - 58
go.sum

@@ -1,13 +1,13 @@
 cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE=
 cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE=
 cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU=
 cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU=
-cloud.google.com/go/auth v0.22.0 h1:Xp9wAKkLoeaYb5pYZZoQGz4E9sdPxIbzS3gywZE3ciQ=
-cloud.google.com/go/auth v0.22.0/go.mod h1:M9o2Oz+YI2jAfxewJgb1vyI3vceHF+eohmxyzmrl+9s=
+cloud.google.com/go/auth v0.23.0 h1:6Gg1CMgpgubRG7DGz5Vf1pcoNo8RfiRiRAPS4crTp54=
+cloud.google.com/go/auth v0.23.0/go.mod h1:4DhBRcqvtljQN3dJ57qtqbib5ZGCYE5f2crfiiC2EM0=
 cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
 cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
 cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
 cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
 cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs=
 cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs=
 cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
 cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
-cloud.google.com/go/iam v1.11.0 h1:KieQ9Pb+LLPak1O3Rv3GgCxhnmkYf7Xyh0P5HfF1jFM=
-cloud.google.com/go/iam v1.11.0/go.mod h1:KP+nKGugNJW4LcLx1uEZcq1ok5sQHFaQehQNl4QDgV4=
+cloud.google.com/go/iam v1.12.0 h1:Aki3bX9aHUDKPHfnRJfDcTdVedvy6quGBQcTqx3DRXk=
+cloud.google.com/go/iam v1.12.0/go.mod h1:FEZ4lXpADAC2AIpQY7LANNjjwyQ2jK439CI2VaD+sLY=
 cloud.google.com/go/kms v1.33.0 h1:pG0X78m212b2pv9N4fdMoUO69LuZGQ9kSvn8sHBOFAo=
 cloud.google.com/go/kms v1.33.0 h1:pG0X78m212b2pv9N4fdMoUO69LuZGQ9kSvn8sHBOFAo=
 cloud.google.com/go/kms v1.33.0/go.mod h1:CSGvW6GnMQbY+1nOHcIzhMtHSbExXlOmCKjWtYVjcpA=
 cloud.google.com/go/kms v1.33.0/go.mod h1:CSGvW6GnMQbY+1nOHcIzhMtHSbExXlOmCKjWtYVjcpA=
 cloud.google.com/go/longrunning v1.2.0 h1:WjYH3YHBGCxGJP9M4dWGHBfXr/cFIjMkNgWcJj7/iMM=
 cloud.google.com/go/longrunning v1.2.0 h1:WjYH3YHBGCxGJP9M4dWGHBfXr/cFIjMkNgWcJj7/iMM=
@@ -22,10 +22,10 @@ filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
 filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
 filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
 github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M=
 github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M=
 github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
 github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
-github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0 h1:aokoqcHvaGjiM3VpjKDfMMnF/8epJ+Q1HLJ7CudztqE=
-github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0/go.mod h1:/WYEx9pcM9Y+Dd/APJaNlSvVSvzl54rrMdZT5+Oi2LM=
-github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0 h1:CU4+EJeJi3TKYWEcYuSdWsjzw0nVsK/H0MSQOiPcymU=
-github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0/go.mod h1:q0+UTSRvShwUCrR/s5HtyInYphN7Wvxb7snFM3u+SLA=
+github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.1 h1:zvXfGJCWvywnCA814d8ZiVyt+fm9nnTE8xSb99zRyfo=
+github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.1/go.mod h1:iptorS+VYKFL2N6PnebpS91dubG35eAOEERnT4PJbQU=
+github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1 h1:u93s+zU2JD62im61Bm5CZIc1ZrOJaIAWEg0WOrMVkEo=
+github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1/go.mod h1:oXtinPO4OLj9d1DOTrqrL1oRwGhcqadvAmrl6wTeGlk=
 github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0 h1:xFaZZ+IubdftrDHnGGwZ6QvQ3KHTtWl2MCK+GMt2vxs=
 github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0 h1:xFaZZ+IubdftrDHnGGwZ6QvQ3KHTtWl2MCK+GMt2vxs=
 github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0/go.mod h1:mCBhUhlMjLLJKr5aqw2TNS/VqJOie8MzWq3DAMJeKso=
 github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0/go.mod h1:mCBhUhlMjLLJKr5aqw2TNS/VqJOie8MzWq3DAMJeKso=
 github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4=
 github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4=
@@ -36,8 +36,8 @@ github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfg
 github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA=
 github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA=
 github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM=
 github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM=
 github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
 github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
-github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 h1:RHK7bS+HQMslb1sZpAokUt+zTVmue0hKSs2C791hhzU=
-github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk=
+github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0 h1:Nljr4q1GRA/5vCrMONS+g4u4LRHNgOXVSh3O43J2CnI=
+github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0/go.mod h1:Y33QHnf0FfdVewFFISOGe20mkZbxX4H839o955/PoeI=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
 github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
 github.com/GoogleCloudPlatform/confidential-space/server v0.0.0-20260522213940-e5c6d01a3007 h1:DoeEFwEGBdqcawmpiWtSsSVVZ+wk3zpqvcvssO2JLmY=
 github.com/GoogleCloudPlatform/confidential-space/server v0.0.0-20260522213940-e5c6d01a3007 h1:DoeEFwEGBdqcawmpiWtSsSVVZ+wk3zpqvcvssO2JLmY=
@@ -56,36 +56,36 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5
 github.com/aws/aws-sdk-go v1.34.0/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
 github.com/aws/aws-sdk-go v1.34.0/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
 github.com/aws/aws-sdk-go v1.55.7 h1:UJrkFq7es5CShfBwlWAC8DA077vp8PyVbQd3lqLiztE=
 github.com/aws/aws-sdk-go v1.55.7 h1:UJrkFq7es5CShfBwlWAC8DA077vp8PyVbQd3lqLiztE=
 github.com/aws/aws-sdk-go v1.55.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
 github.com/aws/aws-sdk-go v1.55.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
-github.com/aws/aws-sdk-go-v2 v1.43.4 h1:b9FTvbRwy+JCsfp2Wp6wV/KbOx3Aj7nkoFb2cRX0IhE=
-github.com/aws/aws-sdk-go-v2 v1.43.4/go.mod h1:70vwSy16txshwG+g55WkpgPKDIByzHI8ccBsOteo3bQ=
-github.com/aws/aws-sdk-go-v2/config v1.32.35 h1:UEzXuET8E42lxBPijuACu/tEK7v5lFPlk0Q+GT5WD9E=
-github.com/aws/aws-sdk-go-v2/config v1.32.35/go.mod h1:KaMtJpFa2JlL2BStjjHQVwQpzZEmw+ND/EgVrfFoo2g=
-github.com/aws/aws-sdk-go-v2/credentials v1.19.34 h1:y6GkSmcv5myd1ngrYbGmiLlwQqB6TQhOuN/tbSSuWDY=
-github.com/aws/aws-sdk-go-v2/credentials v1.19.34/go.mod h1:w3dTcnDVoQIewjo7JG45hduAToikiIFLC4FIO7fndvw=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.35 h1:+S7kbJoLDDQ5tE+lHrUBgMkzC8NLgsaioS2F3dVoFAE=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.35/go.mod h1:Ak7xXviIARfFdNUJ9Etb0bdVDt/KAvKjMGJVLWXDzik=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.35 h1:kzVuGlatQtYinwBJEEyLAbggepCoavosiaHHX9+fD+c=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.35/go.mod h1:0yLx0yEI+SfqeJMPvOtIEFoZbiQYXMGszBueiutQyaI=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.35 h1:WK6CjihTuLisCjSKKbildJ79sGZZgbBz3iNa7VsKIhU=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.35/go.mod h1:KYleN57luLoe97R7vTnx8PMcVrr9gAcRECtOjl91DNg=
-github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.36 h1:jbGY4CXLzZElOXgGsexlC3Hi+3YM0rSmk4opFXKqg/k=
-github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.36/go.mod h1:uBu/9aKsS/UQGc72RAt3y54kjgYQxmhut8ZD2dXCDNE=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.15 h1:JJLBQxwY+AFwuPAi5ivGc1ChnTdUt4cXMv7e76m2c/Y=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.15/go.mod h1:lQknBIe78MVL0cQOQDlag8KGflMbMEVFx9mB6O8ENvk=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.35 h1:BBEElKh4a+rKshvjrfpajTe9CbpZvrbb4Jkg2PB7RzA=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.35/go.mod h1:zaZk983w//8beSruBVec/mr4CmDwgZitW/qzGhAAX0g=
-github.com/aws/aws-sdk-go-v2/service/kms v1.55.4 h1:8T9CDPlcIUpXTKXXfMMFtD1eujGXbVysGiidx79bTkc=
-github.com/aws/aws-sdk-go-v2/service/kms v1.55.4/go.mod h1:XlYycjMbh9zYnTPpjUropzSDngZd/x37jNa9vGHA7hE=
-github.com/aws/aws-sdk-go-v2/service/signin v1.5.4 h1:cOJELVNrq5Q3Udry2GLuHUM7MhwpeaQRdYaoa6GI/yI=
-github.com/aws/aws-sdk-go-v2/service/signin v1.5.4/go.mod h1:f4LxzKBtaTxD7xh3PiVg3CE1tchQemfmghaJr+NbK2c=
-github.com/aws/aws-sdk-go-v2/service/sso v1.33.4 h1:AMW7a7S8iQaHjBYZdU3PCq4GKRPijTPRAc7e6XtEThY=
-github.com/aws/aws-sdk-go-v2/service/sso v1.33.4/go.mod h1:QQNsFV1DVXoXcZt18FS8lI8rtUrlDyAuWZLQ5shunv4=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.38.4 h1:AsbZcJAQPRmHDJG8K1N0pof/1zPWjVT8TFlTWuGLSvo=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.38.4/go.mod h1:6imqztH0//t0mKbl6yWl7swSEl7F/w32oAmqB3vP1ag=
-github.com/aws/aws-sdk-go-v2/service/sts v1.45.4 h1:w/AryDYMjSUANSQ2uoZxJovUsMTwWJNTv3IMex30Y+4=
-github.com/aws/aws-sdk-go-v2/service/sts v1.45.4/go.mod h1:WeBiAa67azG7Su9Vf+ChGDBLiAozJCXzdjXiPBUwtbc=
-github.com/aws/smithy-go v1.27.6 h1:0zjT8jgK3jbrTT7JJ3EE6JsMhX8JTrZ+f1sEndYDXrA=
-github.com/aws/smithy-go v1.27.6/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
+github.com/aws/aws-sdk-go-v2 v1.45.1 h1:iIoG3NaLhV6UZpPXyPXlDj2I9oS8tV/nMcMnITCC6Ks=
+github.com/aws/aws-sdk-go-v2 v1.45.1/go.mod h1:bttEH6JqnUL8LepvDVfdrds/fZ5bCIxzpe3abyUrhDU=
+github.com/aws/aws-sdk-go-v2/config v1.33.1 h1:bq9jze1hQ5YTCLoVxNnbp0T7rglrlOE7N9YsHqjGkEw=
+github.com/aws/aws-sdk-go-v2/config v1.33.1/go.mod h1:2A3HQwG4zaL5Tm80rc6RZj8LmWWv4WYT5v8raSz/L7A=
+github.com/aws/aws-sdk-go-v2/credentials v1.20.1 h1:Z8GRNEx0u9sDkZOq4PUnN8mjGwbUQGRzMSXpvt3d8xQ=
+github.com/aws/aws-sdk-go-v2/credentials v1.20.1/go.mod h1:uBIK00kFo95dnemqfFMTWx0X8YRqsh6ecIoCjjOkZqM=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.1 h1:YIEBqcqRnpi4Pfv0YHImtgi6czGCwKHANC7SwmUAVD0=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.1/go.mod h1:imEf0oufgAo8KAkCHhrOdqGEC0YWx1PPBQH82shSxGw=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.1 h1:pc138gM1CW+XPc60rEwUlwwuwWFQK16CI1T7v1F9Oec=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.1/go.mod h1:1+koxpPIbfBdfzP6vojm5/zTpTQ/micYwlxIiNB3TxI=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.1 h1:K0JsbZQj+1h208Ro1zHeA4l7bMp0NvRffHQ91q8Ol1s=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.1/go.mod h1:W3/vL6EtCIatICGy9ab29QhMuae+cOKPWcMxv02CO+Q=
+github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.1 h1:yhw5KD1phVyP9vijxOUzDfEtJx+bt+L63k+VfuiYFAA=
+github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.1/go.mod h1:ZW2e0d7DYlRxlS9hEiMXE47gTdX5KRN4byUiNbUpG+Q=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19 h1:bAdDl/HkGCcGPoe25ToSHEw23VIxt6CT5fLcg111BKg=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19/go.mod h1:KaUzbLxv4CeSxh6ZCl9B4m7CuFenS8kUEaDs+f/DQr4=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.1 h1:RmmWQPREQdk9U+PfqeHW3MqZaBaNK7TpV9W3RY+b+7g=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.1/go.mod h1:0A3W4F+68ZnNk5XcNL/e9HFMwnP8RlEicFfy6eOEDyw=
+github.com/aws/aws-sdk-go-v2/service/kms v1.57.1 h1:z0+ZRgFCZQzc5o4Ke9ni4zXGn/k7Hoy5JkbZPrXl9CI=
+github.com/aws/aws-sdk-go-v2/service/kms v1.57.1/go.mod h1:EzyGQwPscu9Pwk4XJx5PrG0g8Wxtc2sv8ullQP1NIJA=
+github.com/aws/aws-sdk-go-v2/service/signin v1.7.1 h1:mdMtSVKdQ3+mzBh+l0ogrFYZVQUCg6pJZOirA2ARsYE=
+github.com/aws/aws-sdk-go-v2/service/signin v1.7.1/go.mod h1:9IqUlsJDbUPcg6cgx3WEzXdjrbWzLDQrak0aaSqlTcI=
+github.com/aws/aws-sdk-go-v2/service/sso v1.35.1 h1:B6WFn91tobD6gG4724ONHaqrpKsoETGnv98LHe/yIGM=
+github.com/aws/aws-sdk-go-v2/service/sso v1.35.1/go.mod h1:tWuiVBUtPBr8/rgRiYS8Uf85sHcAN+G7XS3D3CEoUh8=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.40.1 h1:6yeYCWFvgbI2TI3K6jr9LtBNhXgJ7g4xqD+DEiaDDmM=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.40.1/go.mod h1:naFe83jSMuYkH+QjQPX8n1MLhBkeCFM5Lsnh5m5wz3c=
+github.com/aws/aws-sdk-go-v2/service/sts v1.47.1 h1:Sv2xPnRHlThSUtVujYuUBPI/Il8si6UPHXL8DMiB/F0=
+github.com/aws/aws-sdk-go-v2/service/sts v1.47.1/go.mod h1:mKo/CzaCz8qytGW70NG4vIIGAx1HXTlb5lHNkC5k3lk=
+github.com/aws/smithy-go v1.28.1 h1:R/nXH00c8qcfCzQVELtRw+eLQWtzv+VAIEFJ1/xxXlQ=
+github.com/aws/smithy-go v1.28.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
 github.com/ccoveille/go-safecast/v2 v2.0.1 h1:2+mIu3gXtwmWelBia2kkxfB8eP4orTHDH7ClSlWkd6I=
 github.com/ccoveille/go-safecast/v2 v2.0.1 h1:2+mIu3gXtwmWelBia2kkxfB8eP4orTHDH7ClSlWkd6I=
@@ -211,10 +211,10 @@ github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
 github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
 github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
 github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
 github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
 github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/googleapis/enterprise-certificate-proxy v0.3.19 h1:mMOE7DN2+p76/EdIrmAy9B9bH+yC4563vmnJ34QR8i4=
-github.com/googleapis/enterprise-certificate-proxy v0.3.19/go.mod h1:rSEsBUemEBZEexP2y6jPp16LUmUbjmSbcPMQizR0o4k=
-github.com/googleapis/gax-go/v2 v2.23.0 h1:Tchl7qkvE7Ip3y+ztvNufYFvkfqTe7NfLTYGIdJRLuE=
-github.com/googleapis/gax-go/v2 v2.23.0/go.mod h1:rBQKOVJCdb8IFEzg+FCwlt1LP/xMDGuqUXhUG+XMXEg=
+github.com/googleapis/enterprise-certificate-proxy v0.3.20 h1:t/xL64VUoN69MuMRQuJETqYGOw4Z9mSRJK9epIEtwFk=
+github.com/googleapis/enterprise-certificate-proxy v0.3.20/go.mod h1:L3D/IQExI6LqEjBdXcZQ1WluSgigQmSwBboFstVPM4w=
+github.com/googleapis/gax-go/v2 v2.24.0 h1:myMaPYyF9MecEmvQqMqomIwn9t/4KCZN9qnwsS76wlg=
+github.com/googleapis/gax-go/v2 v2.24.0/go.mod h1:IaTHBDd7NHxSCiu0vEs8pQZu4dGZrWwuSoxCnk16OFM=
 github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
 github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
 github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
 github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
 github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
 github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -424,8 +424,8 @@ go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRk
 go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
 go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
 go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
 go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
 go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
 go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
-go.step.sm/crypto v0.89.0 h1:NPxryE+cZ4XDwXOQY2U6Gu+mOzOihuRLPIsX7WtPzZM=
-go.step.sm/crypto v0.89.0/go.mod h1:IEgE6DndnYojbDyHU7eYXpwWzpu4ftkouw7nyI6jsxg=
+go.step.sm/crypto v0.90.0-rc1 h1:poCQMsqKDR2lhNuyzPpDjBk/Sfd7PHQKgYpM5Ucxaqk=
+go.step.sm/crypto v0.90.0-rc1/go.mod h1:dgT4uZ4cClpjCi6HZZAmLomgn5tOfpHTqb34lTFN2PQ=
 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
 go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
 go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
 go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
 go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
@@ -443,8 +443,8 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
 golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
 golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
 golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
 golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
 golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
 golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
-golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
-golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
+golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y=
+golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I=
 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
 golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
 golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
@@ -533,16 +533,16 @@ golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
 gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
 gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
 gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
-google.golang.org/api v0.292.0 h1:Ewiwo/GTtiaPZSNAZQUcWLh8AYDEoPmIXyJfeoTSMHU=
-google.golang.org/api v0.292.0/go.mod h1:07kjmMnFGm2RQuCza2EZM/5N68G/fVvFb1xKjWqoFA0=
-google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0=
-google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I=
-google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7 h1:jQ9p21COKWjP3VwuFrNRiiOTMh3mPpN45R7SLrH/HUU=
-google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7/go.mod h1:KqHwBx2upmfa1XSi1WuRvC+2VGCLtooKkfmyvRbUmqA=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d h1:IL4hdHzcUv2l/gcg98/Rj3FbtE6axwqslOW8SW0C+S0=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
-google.golang.org/grpc v1.83.1 h1:HIO0+BEtBP6soyqvqC8sNUjZ7bTs+0hFQuFF+RAy++Y=
-google.golang.org/grpc v1.83.1/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ=
+google.golang.org/api v0.293.0 h1:p9XIWOf63U4OgYx120ZwVU8+vl4XTPmWfgVPnmOAS9w=
+google.golang.org/api v0.293.0/go.mod h1:6n5tjEB1gzwniZTepZ0g5u+wM7Bof5GeULCx/zh8ZE0=
+google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d h1:C9v1o0/4quuhOAfmRXA2j+we0PqZIp8traLdeogF3Ms=
+google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d/go.mod h1:Wz2wFJntZFmLGo7pLDXZ3wYk5hyc0Mb+SkHhDDXT+lU=
+google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d h1:QwnJwPte4XXAkhPu26LTDIahnsMSUV0kK8HkxbC+Pc4=
+google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d/go.mod h1:WRrQ7/7N19PypuT0fxLOL5Lq0waoiRri4FbtHDEKrGE=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20260807164820-c8921c73eeea h1:kVhQEPTpKQahD5+JSBTfBB19wcgQTTjAIn45MBqnyHk=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20260807164820-c8921c73eeea/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
+google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
+google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 h1:rgSNvqscFZ1JgV/4wH5GOsZFSFkR2Eua9As3KIr2LlM=
 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 h1:rgSNvqscFZ1JgV/4wH5GOsZFSFkR2Eua9As3KIr2LlM=
 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2/go.mod h1:iMEtFwDlAhjDU9L5mY6U1XLwlIId/G3h+QcBHDIvrJ8=
 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2/go.mod h1:iMEtFwDlAhjDU9L5mY6U1XLwlIId/G3h+QcBHDIvrJ8=
 google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
 google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=

+ 82 - 0
internal/cryptoutil/cryptoutil.go

@@ -0,0 +1,82 @@
+// Package cryptoutil provides small helpers for inspecting and encoding the
+// key and certificate types used across the CA.
+package cryptoutil
+
+import (
+	"crypto"
+	"crypto/ecdsa"
+	"crypto/ed25519"
+	"crypto/rsa"
+	"crypto/x509"
+	"encoding/pem"
+	"fmt"
+
+	"go.step.sm/crypto/mldsa"
+)
+
+// IsSupportedPublicKey reports whether pub is a public key type that the CA
+// knows how to work with. Anything else, including a nil key, is rejected.
+func IsSupportedPublicKey(pub crypto.PublicKey) bool {
+	switch pub.(type) {
+	case *rsa.PublicKey, *ecdsa.PublicKey, ed25519.PublicKey, *mldsa.PublicKey:
+		return true
+	default:
+		return false
+	}
+}
+
+// IsSupportedPrivateKey reports whether priv is a private key type that the CA
+// knows how to work with. Anything else, including a nil key, is rejected.
+//
+// Note that keys living outside the process, like the ones backed by a KMS,
+// are not reported as supported here; they only satisfy crypto.Signer.
+func IsSupportedPrivateKey(priv crypto.PrivateKey) bool {
+	switch priv.(type) {
+	case *rsa.PrivateKey, *ecdsa.PrivateKey, ed25519.PrivateKey, *mldsa.PrivateKey:
+		return true
+	default:
+		return false
+	}
+}
+
+// PEMEncode encodes a key, a certificate or a certificate request using PEM.
+//
+// Public keys are marshaled using PKIX and private keys using PKCS #8, so the
+// resulting blocks are always "PUBLIC KEY" and "PRIVATE KEY"; the legacy
+// "RSA PRIVATE KEY" and "EC PRIVATE KEY" forms are never produced. Certificates
+// and certificate requests are encoded from their raw DER bytes, which means
+// they must have been parsed or created beforehand.
+func PEMEncode(key any) ([]byte, error) {
+	switch k := key.(type) {
+	case *rsa.PublicKey, *ecdsa.PublicKey, ed25519.PublicKey, *mldsa.PublicKey:
+		b, err := x509.MarshalPKIXPublicKey(key)
+		if err != nil {
+			return nil, fmt.Errorf("error marshaling public key: %w", err)
+		}
+		return pem.EncodeToMemory(&pem.Block{
+			Type:  "PUBLIC KEY",
+			Bytes: b,
+		}), nil
+	case *rsa.PrivateKey, *ecdsa.PrivateKey, ed25519.PrivateKey, *mldsa.PrivateKey:
+		b, err := x509.MarshalPKCS8PrivateKey(key)
+		if err != nil {
+			return nil, fmt.Errorf("error marshaling private key: %w", err)
+		}
+		return pem.EncodeToMemory(&pem.Block{
+			Type:  "PRIVATE KEY",
+			Bytes: b,
+		}), nil
+	case *x509.Certificate:
+		return pem.EncodeToMemory(&pem.Block{
+			Type:  "CERTIFICATE",
+			Bytes: k.Raw,
+		}), nil
+	case *x509.CertificateRequest:
+		return pem.EncodeToMemory(&pem.Block{
+			Type:  "CERTIFICATE REQUEST",
+			Bytes: k.Raw,
+		}), nil
+	default:
+		return nil, fmt.Errorf("error PEM encoding: unsupported type %T", key)
+	}
+}

+ 196 - 0
internal/cryptoutil/cryptoutil_test.go

@@ -0,0 +1,196 @@
+package cryptoutil
+
+import (
+	"crypto"
+	"crypto/dsa" //nolint:staticcheck // DSA is only used to build an unsupported key
+	"crypto/ecdsa"
+	"crypto/ed25519"
+	"crypto/elliptic"
+	"crypto/rand"
+	"crypto/rsa"
+	"crypto/x509"
+	"crypto/x509/pkix"
+	"encoding/pem"
+	"math/big"
+	"testing"
+	"time"
+
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+	"go.step.sm/crypto/mldsa"
+)
+
+func TestIsSupportedPublicKey(t *testing.T) {
+	tests := []struct {
+		name string
+		pub  crypto.PublicKey
+		want bool
+	}{
+		{"rsa", &rsa.PublicKey{}, true},
+		{"ecdsa", &ecdsa.PublicKey{}, true},
+		{"ed25519", ed25519.PublicKey{}, true},
+		{"mldsa", &mldsa.PublicKey{}, true},
+		{"dsa", &dsa.PublicKey{}, false},
+		{"rsa value", rsa.PublicKey{}, false},
+		{"ecdsa value", ecdsa.PublicKey{}, false},
+		{"ed25519 pointer", &ed25519.PublicKey{}, false},
+		{"private key", &rsa.PrivateKey{}, false},
+		{"bytes", []byte("not a key"), false},
+		{"nil", nil, false},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			assert.Equal(t, tt.want, IsSupportedPublicKey(tt.pub))
+		})
+	}
+}
+
+func TestIsSupportedPrivateKey(t *testing.T) {
+	tests := []struct {
+		name string
+		priv crypto.PrivateKey
+		want bool
+	}{
+		{"rsa", &rsa.PrivateKey{}, true},
+		{"ecdsa", &ecdsa.PrivateKey{}, true},
+		{"ed25519", ed25519.PrivateKey{}, true},
+		{"mldsa", &mldsa.PrivateKey{}, true},
+		{"dsa", &dsa.PrivateKey{}, false},
+		{"rsa value", rsa.PrivateKey{}, false},
+		{"ecdsa value", ecdsa.PrivateKey{}, false},
+		{"ed25519 pointer", &ed25519.PrivateKey{}, false},
+		{"public key", &rsa.PublicKey{}, false},
+		{"bytes", []byte("not a key"), false},
+		{"nil", nil, false},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			assert.Equal(t, tt.want, IsSupportedPrivateKey(tt.priv))
+		})
+	}
+}
+
+func TestPEMEncode(t *testing.T) {
+	rsaKey, err := rsa.GenerateKey(rand.Reader, 2048)
+	require.NoError(t, err)
+	ecdsaKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
+	require.NoError(t, err)
+	_, ed25519Key, err := ed25519.GenerateKey(rand.Reader)
+	require.NoError(t, err)
+
+	cert := mustCertificate(t, ecdsaKey)
+	csr := mustCertificateRequest(t, ecdsaKey)
+
+	type test struct {
+		name    string
+		key     any
+		want    *pem.Block
+		wantErr string
+	}
+	tests := []test{
+		{"rsa public key", rsaKey.Public(), &pem.Block{
+			Type: "PUBLIC KEY", Bytes: mustPKIX(t, rsaKey.Public()),
+		}, ""},
+		{"ecdsa public key", ecdsaKey.Public(), &pem.Block{
+			Type: "PUBLIC KEY", Bytes: mustPKIX(t, ecdsaKey.Public()),
+		}, ""},
+		{"ed25519 public key", ed25519Key.Public(), &pem.Block{
+			Type: "PUBLIC KEY", Bytes: mustPKIX(t, ed25519Key.Public()),
+		}, ""},
+		{"rsa private key", rsaKey, &pem.Block{
+			Type: "PRIVATE KEY", Bytes: mustPKCS8(t, rsaKey),
+		}, ""},
+		{"ecdsa private key", ecdsaKey, &pem.Block{
+			Type: "PRIVATE KEY", Bytes: mustPKCS8(t, ecdsaKey),
+		}, ""},
+		{"ed25519 private key", ed25519Key, &pem.Block{
+			Type: "PRIVATE KEY", Bytes: mustPKCS8(t, ed25519Key),
+		}, ""},
+		{"certificate", cert, &pem.Block{
+			Type: "CERTIFICATE", Bytes: cert.Raw,
+		}, ""},
+		{"certificate request", csr, &pem.Block{
+			Type: "CERTIFICATE REQUEST", Bytes: csr.Raw,
+		}, ""},
+		{"fail public key", &ecdsa.PublicKey{}, nil, "error marshaling public key"},
+		{"fail private key", &ecdsa.PrivateKey{}, nil, "error marshaling private key"},
+		{"fail dsa public key", &dsa.PublicKey{}, nil, "unsupported type *dsa.PublicKey"},
+		{"fail bytes", []byte("not a key"), nil, "unsupported type []uint8"},
+		{"fail nil", nil, nil, "unsupported type <nil>"},
+	}
+
+	// ML-DSA is only available on Go 1.27 and later. On older toolchains the
+	// mldsa package is a stub that cannot generate keys, so there is nothing
+	// to encode.
+	if mldsa.Supported {
+		mldsaKey, err := mldsa.GenerateKey(mldsa.MLDSA44())
+		require.NoError(t, err)
+		tests = append(tests,
+			test{"mldsa public key", mldsaKey.Public(), &pem.Block{
+				Type: "PUBLIC KEY", Bytes: mustPKIX(t, mldsaKey.Public()),
+			}, ""},
+			test{"mldsa private key", mldsaKey, &pem.Block{
+				Type: "PRIVATE KEY", Bytes: mustPKCS8(t, mldsaKey),
+			}, ""},
+		)
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got, err := PEMEncode(tt.key)
+			if tt.wantErr != "" {
+				assert.ErrorContains(t, err, tt.wantErr)
+				assert.Nil(t, got)
+				return
+			}
+
+			require.NoError(t, err)
+			block, rest := pem.Decode(got)
+			require.NotNil(t, block)
+			assert.Empty(t, rest)
+			assert.Equal(t, tt.want.Type, block.Type)
+			assert.Equal(t, tt.want.Bytes, block.Bytes)
+			assert.Empty(t, block.Headers)
+		})
+	}
+}
+
+func mustPKIX(t *testing.T, pub crypto.PublicKey) []byte {
+	t.Helper()
+	b, err := x509.MarshalPKIXPublicKey(pub)
+	require.NoError(t, err)
+	return b
+}
+
+func mustPKCS8(t *testing.T, priv crypto.PrivateKey) []byte {
+	t.Helper()
+	b, err := x509.MarshalPKCS8PrivateKey(priv)
+	require.NoError(t, err)
+	return b
+}
+
+func mustCertificate(t *testing.T, signer crypto.Signer) *x509.Certificate {
+	t.Helper()
+	template := &x509.Certificate{
+		SerialNumber: big.NewInt(1234),
+		Subject:      pkix.Name{CommonName: "test.smallstep.com"},
+		NotBefore:    time.Now(),
+		NotAfter:     time.Now().Add(time.Hour),
+	}
+	der, err := x509.CreateCertificate(rand.Reader, template, template, signer.Public(), signer)
+	require.NoError(t, err)
+	cert, err := x509.ParseCertificate(der)
+	require.NoError(t, err)
+	return cert
+}
+
+func mustCertificateRequest(t *testing.T, signer crypto.Signer) *x509.CertificateRequest {
+	t.Helper()
+	der, err := x509.CreateCertificateRequest(rand.Reader, &x509.CertificateRequest{
+		Subject: pkix.Name{CommonName: "test.smallstep.com"},
+	}, signer)
+	require.NoError(t, err)
+	csr, err := x509.ParseCertificateRequest(der)
+	require.NoError(t, err)
+	return csr
+}

+ 2 - 3
logging/handler.go

@@ -1,6 +1,7 @@
 package logging
 package logging
 
 
 import (
 import (
+	"maps"
 	"net"
 	"net"
 	"net/http"
 	"net/http"
 	"os"
 	"os"
@@ -121,9 +122,7 @@ func (l *LoggerHandler) writeEntry(w ResponseLogger, r *http.Request, t time.Tim
 		"user-agent":     sanitizeLogEntry(r.UserAgent()),
 		"user-agent":     sanitizeLogEntry(r.UserAgent()),
 	}
 	}
 
 
-	for k, v := range w.Fields() {
-		fields[k] = v
-	}
+	maps.Copy(fields, w.Fields())
 
 
 	switch {
 	switch {
 	case status < http.StatusBadRequest:
 	case status < http.StatusBadRequest:

+ 8 - 9
logging/responselogger.go

@@ -2,6 +2,7 @@ package logging
 
 
 import (
 import (
 	"bufio"
 	"bufio"
+	"maps"
 	"net"
 	"net"
 	"net/http"
 	"net/http"
 )
 )
@@ -13,8 +14,8 @@ type ResponseLogger interface {
 	http.ResponseWriter
 	http.ResponseWriter
 	Size() int
 	Size() int
 	StatusCode() int
 	StatusCode() int
-	Fields() map[string]interface{}
-	WithFields(map[string]interface{})
+	Fields() map[string]any
+	WithFields(map[string]any)
 }
 }
 
 
 // NewResponseLogger wraps the given response writer with methods to capture
 // NewResponseLogger wraps the given response writer with methods to capture
@@ -46,7 +47,7 @@ type rwDefault struct {
 	http.ResponseWriter
 	http.ResponseWriter
 	code   int
 	code   int
 	size   int
 	size   int
-	fields map[string]interface{}
+	fields map[string]any
 }
 }
 
 
 func (r *rwDefault) Header() http.Header {
 func (r *rwDefault) Header() http.Header {
@@ -72,17 +73,15 @@ func (r *rwDefault) StatusCode() int {
 	return r.code
 	return r.code
 }
 }
 
 
-func (r *rwDefault) Fields() map[string]interface{} {
+func (r *rwDefault) Fields() map[string]any {
 	return r.fields
 	return r.fields
 }
 }
 
 
-func (r *rwDefault) WithFields(fields map[string]interface{}) {
+func (r *rwDefault) WithFields(fields map[string]any) {
 	if r.fields == nil {
 	if r.fields == nil {
-		r.fields = make(map[string]interface{}, len(fields))
-	}
-	for k, v := range fields {
-		r.fields[k] = v
+		r.fields = make(map[string]any, len(fields))
 	}
 	}
+	maps.Copy(r.fields, fields)
 }
 }
 
 
 type rwFlusher struct {
 type rwFlusher struct {

+ 1 - 1
pki/pki.go

@@ -557,7 +557,7 @@ func (p *PKI) GenerateRootCertificate(name, org, resource string, pass []byte) (
 }
 }
 
 
 // WriteRootCertificate writes to the buffer the given certificate and key if given.
 // WriteRootCertificate writes to the buffer the given certificate and key if given.
-func (p *PKI) WriteRootCertificate(rootCrt *x509.Certificate, rootKey interface{}, pass []byte) error {
+func (p *PKI) WriteRootCertificate(rootCrt *x509.Certificate, rootKey any, pass []byte) error {
 	p.Files[p.Root[0]] = encodeCertificate(rootCrt)
 	p.Files[p.Root[0]] = encodeCertificate(rootCrt)
 	if rootKey != nil {
 	if rootKey != nil {
 		var err error
 		var err error

+ 1 - 1
pki/templates.go

@@ -20,7 +20,7 @@ func (p *PKI) getTemplates() *templates.Templates {
 	}
 	}
 	return &templates.Templates{
 	return &templates.Templates{
 		SSH:  &templates.DefaultSSHTemplates,
 		SSH:  &templates.DefaultSSHTemplates,
-		Data: map[string]interface{}{},
+		Data: map[string]any{},
 	}
 	}
 }
 }
 
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.