mirror of
https://github.com/smallstep/certificates.git
synced 2024-11-15 18:12:59 +00:00
29 lines
627 B
Go
29 lines
627 B
Go
package scep
|
|
|
|
import (
|
|
"context"
|
|
"crypto"
|
|
"crypto/x509"
|
|
)
|
|
|
|
// Service is a wrapper for crypto.Signer and crypto.Decrypter
|
|
type Service struct {
|
|
certificateChain []*x509.Certificate
|
|
signer crypto.Signer
|
|
decrypter crypto.Decrypter
|
|
}
|
|
|
|
func NewService(ctx context.Context, opts Options) (*Service, error) {
|
|
|
|
if err := opts.Validate(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
// TODO: should this become similar to the New CertificateAuthorityService as in x509CAService?
|
|
return &Service{
|
|
certificateChain: opts.CertificateChain,
|
|
signer: opts.Signer,
|
|
decrypter: opts.Decrypter,
|
|
}, nil
|
|
}
|