You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
smallstep-certificates/cas/apiv1/services.go

45 lines
1.2 KiB
Go

package apiv1
import (
"encoding/asn1"
"strings"
)
var (
oidStepRoot = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 37476, 9000, 64}
oidStepCertificateAuthority = append(asn1.ObjectIdentifier(nil), append(oidStepRoot, 2)...)
)
// CertificateAuthorityService is the interface implemented to support external
// certificate authorities.
type CertificateAuthorityService interface {
CreateCertificate(req *CreateCertificateRequest) (*CreateCertificateResponse, error)
RenewCertificate(req *RenewCertificateRequest) (*RenewCertificateResponse, error)
RevokeCertificate(req *RevokeCertificateRequest) (*RevokeCertificateResponse, error)
}
// Type represents the KMS type used.
type Type string
const (
// DefaultCAS is a CertificateAuthorityService using software.
DefaultCAS = ""
// SoftCAS is a CertificateAuthorityService using software.
SoftCAS = "SoftCAS"
// CloudCAS is a CertificateAuthorityService using Google Cloud CAS.
CloudCAS = "CloudCAS"
)
// String returns the given type as a string. All the letters will be lowercase.
func (t Type) String() string {
if t == "" {
return SoftCAS
}
for _, s := range []string{SoftCAS, CloudCAS} {
if strings.EqualFold(s, string(t)) {
return s
}
}
return string(t)
}