|
|
|
@ -748,14 +748,15 @@ func ProvisionerToCertificates(p *linkedca.Provisioner) (provisioner.Interface,
|
|
|
|
|
case *linkedca.ProvisionerDetails_ACME:
|
|
|
|
|
cfg := d.ACME
|
|
|
|
|
return &provisioner.ACME{
|
|
|
|
|
ID: p.Id,
|
|
|
|
|
Type: p.Type.String(),
|
|
|
|
|
Name: p.Name,
|
|
|
|
|
ForceCN: cfg.ForceCn,
|
|
|
|
|
RequireEAB: cfg.RequireEab,
|
|
|
|
|
Challenges: challengesToCertificates(cfg.Challenges),
|
|
|
|
|
Claims: claims,
|
|
|
|
|
Options: options,
|
|
|
|
|
ID: p.Id,
|
|
|
|
|
Type: p.Type.String(),
|
|
|
|
|
Name: p.Name,
|
|
|
|
|
ForceCN: cfg.ForceCn,
|
|
|
|
|
RequireEAB: cfg.RequireEab,
|
|
|
|
|
Challenges: challengesToCertificates(cfg.Challenges),
|
|
|
|
|
AttestationFormats: attestationFormatsToCertificates(cfg.AttestationFormats),
|
|
|
|
|
Claims: claims,
|
|
|
|
|
Options: options,
|
|
|
|
|
}, nil
|
|
|
|
|
case *linkedca.ProvisionerDetails_OIDC:
|
|
|
|
|
cfg := d.OIDC
|
|
|
|
@ -1002,8 +1003,9 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
|
|
|
|
|
Details: &linkedca.ProvisionerDetails{
|
|
|
|
|
Data: &linkedca.ProvisionerDetails_ACME{
|
|
|
|
|
ACME: &linkedca.ACMEProvisioner{
|
|
|
|
|
ForceCn: p.ForceCN,
|
|
|
|
|
Challenges: challengesToLinkedca(p.Challenges),
|
|
|
|
|
ForceCn: p.ForceCN,
|
|
|
|
|
Challenges: challengesToLinkedca(p.Challenges),
|
|
|
|
|
AttestationFormats: attestationFormatsToLinkedca(p.AttestationFormats),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -1162,3 +1164,37 @@ func challengesToLinkedca(challenges []provisioner.ACMEChallenge) []linkedca.ACM
|
|
|
|
|
}
|
|
|
|
|
return ret
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// attestationFormatsToCertificates converts linkedca attestation formats to
|
|
|
|
|
// provisioner ones skipping the unknown ones.
|
|
|
|
|
func attestationFormatsToCertificates(formats []linkedca.ACMEProvisioner_AttestationFormatType) []provisioner.ACMEAttestationFormat {
|
|
|
|
|
ret := make([]provisioner.ACMEAttestationFormat, 0, len(formats))
|
|
|
|
|
for _, f := range formats {
|
|
|
|
|
switch f {
|
|
|
|
|
case linkedca.ACMEProvisioner_APPLE:
|
|
|
|
|
ret = append(ret, provisioner.APPLE)
|
|
|
|
|
case linkedca.ACMEProvisioner_STEP:
|
|
|
|
|
ret = append(ret, provisioner.STEP)
|
|
|
|
|
case linkedca.ACMEProvisioner_TPM:
|
|
|
|
|
ret = append(ret, provisioner.TPM)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// attestationFormatsToLinkedca converts provisioner attestation formats to
|
|
|
|
|
// linkedca ones skipping the unknown ones.
|
|
|
|
|
func attestationFormatsToLinkedca(formats []provisioner.ACMEAttestationFormat) []linkedca.ACMEProvisioner_AttestationFormatType {
|
|
|
|
|
ret := make([]linkedca.ACMEProvisioner_AttestationFormatType, 0, len(formats))
|
|
|
|
|
for _, f := range formats {
|
|
|
|
|
switch provisioner.ACMEAttestationFormat(f.String()) {
|
|
|
|
|
case provisioner.APPLE:
|
|
|
|
|
ret = append(ret, linkedca.ACMEProvisioner_APPLE)
|
|
|
|
|
case provisioner.STEP:
|
|
|
|
|
ret = append(ret, linkedca.ACMEProvisioner_STEP)
|
|
|
|
|
case provisioner.TPM:
|
|
|
|
|
ret = append(ret, linkedca.ACMEProvisioner_TPM)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret
|
|
|
|
|
}
|
|
|
|
|