cacert-gosigner/x509/signing/signer.go

41 lines
880 B
Go

package signing
import (
"crypto/x509"
"crypto/x509/pkix"
"time"
)
type SignerRequest struct {
CSR *x509.CertificateRequest
SubjectDN pkix.Name
Emails []string
DnsNames []string
Duration time.Duration
SignatureAlgorithm x509.SignatureAlgorithm
}
func NewSignerRequest(
csr *x509.CertificateRequest,
subjectDN pkix.Name,
emails, dnsNames []string,
duration time.Duration,
signatureAlgorithm x509.SignatureAlgorithm,
) *SignerRequest {
return &SignerRequest{
CSR: csr,
SubjectDN: subjectDN,
Emails: emails,
DnsNames: dnsNames,
Duration: duration,
SignatureAlgorithm: signatureAlgorithm,
}
}
type SignerResponse struct {
Certificate *x509.Certificate
}
type Signer interface {
SignCertificate(*SignerRequest) (*SignerResponse, error)
}