cacert-gosigner/pkg/x509/signing/signer.go
Jan Dittberner 63c3716b5b Move x509 and openpgp into pkg
small refactoring to unify package structure. Use crypto.rand for serial
number generation in tests.
2022-04-24 08:03:51 +02:00

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)
}