Explorar o código

Pass Android Key Attestation CRL checker from authority creation

Herman Slatman hai 4 meses
pai
achega
c4ca1a6a4d
Modificáronse 3 ficheiros con 24 adicións e 11 borrados
  1. 13 11
      authority/authority.go
  2. 10 0
      authority/options.go
  3. 1 0
      authority/provisioners.go

+ 13 - 11
authority/authority.go

@@ -30,6 +30,7 @@ import (
 	"github.com/smallstep/certificates/authority/internal/constraints"
 	"github.com/smallstep/certificates/authority/policy"
 	"github.com/smallstep/certificates/authority/provisioner"
+	"github.com/smallstep/certificates/authority/provisioner/androidkey"
 	"github.com/smallstep/certificates/cas"
 	casapi "github.com/smallstep/certificates/cas/apiv1"
 	"github.com/smallstep/certificates/db"
@@ -41,17 +42,18 @@ import (
 
 // Authority implements the Certificate Authority internal interface.
 type Authority struct {
-	config        *config.Config
-	keyManager    kms.KeyManager
-	provisioners  *provisioner.Collection
-	admins        *administrator.Collection
-	db            db.AuthDB
-	adminDB       admin.DB
-	templates     *templates.Templates
-	linkedCAToken string
-	wrapTransport httptransport.Wrapper
-	webhookClient provisioner.HTTPClient
-	httpClient    provisioner.HTTPClient
+	config               *config.Config
+	keyManager           kms.KeyManager
+	provisioners         *provisioner.Collection
+	admins               *administrator.Collection
+	db                   db.AuthDB
+	adminDB              admin.DB
+	templates            *templates.Templates
+	linkedCAToken        string
+	wrapTransport        httptransport.Wrapper
+	webhookClient        provisioner.HTTPClient
+	httpClient           provisioner.HTTPClient
+	androidKeyCRLChecker androidkey.CRLChecker
 
 	// X509 CA
 	password              []byte

+ 10 - 0
authority/options.go

@@ -14,6 +14,7 @@ import (
 	"github.com/smallstep/certificates/authority/admin"
 	"github.com/smallstep/certificates/authority/config"
 	"github.com/smallstep/certificates/authority/provisioner"
+	"github.com/smallstep/certificates/authority/provisioner/androidkey"
 	"github.com/smallstep/certificates/cas"
 	casapi "github.com/smallstep/certificates/cas/apiv1"
 	"github.com/smallstep/certificates/db"
@@ -103,6 +104,15 @@ func WithWebhookClient(c provisioner.HTTPClient) Option {
 	}
 }
 
+// WithAndroidKeyCRLChecker sets the [androidkey.CRLChecker] to be
+// used to check Android Key Attestation certificate revocation status.
+func WithAndroidKeyCRLChecker(c androidkey.CRLChecker) Option {
+	return func(a *Authority) error {
+		a.androidKeyCRLChecker = c
+		return nil
+	}
+}
+
 // Wrapper wraps the set of functions mapping [http.Transport] references to [http.RoundTripper].
 type TransportWrapper = httptransport.Wrapper
 

+ 1 - 0
authority/provisioners.go

@@ -205,6 +205,7 @@ func (a *Authority) generateProvisionerConfig(ctx context.Context) (provisioner.
 		HTTPClient:            a.httpClient,
 		WrapTransport:         a.wrapTransport,
 		SCEPKeyManager:        a.scepKeyManager,
+		AndroidKeyCRLChecker:  a.androidKeyCRLChecker,
 	}, nil
 }