Documentation ¶
Index ¶
- func CreateCertReq(opts *CertOptions, privateKey *rsa.PrivateKey) (*x509.CertificateRequest, error)
- func CreateCertReqWithKey(opts *CertOptions) (*x509.CertificateRequest, *rsa.PrivateKey, error)
- func InitCA(opts *CertOptions, certOut, keyOut string) error
- func LoadCertificate(filename string, osWrapper Oser) (*x509.Certificate, error)
- func LoadFromPEMFile(filename string, osWrapper Oser) ([]interface{}, error)
- func LoadPrivateKey(filename string, osWrapper Oser) (*rsa.PrivateKey, error)
- func LoadPublicKey(filename string, osWrapper Oser) (*rsa.PublicKey, error)
- func LoadRequest(filename string, osWrapper Oser) (*x509.CertificateRequest, error)
- func MakeReq(opts *CertOptions, keyIn, keyOut, reqOut string) error
- func SaveToPEMFile(filename string, data []interface{}, osWrapper Oser) error
- func SignCertReq(req *x509.CertificateRequest, ca *CA, opts *CertOptions) (*x509.Certificate, error)
- func SignReq(opts *CertOptions, caCrtPath, caKeyPath, reqPath, certOut string, verify bool) error
- type CA
- type CertNames
- type CertOptions
- type OsWrapper
- type Oser
- type RsaWrapper
- type Rsaer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCertReq ¶
func CreateCertReq(opts *CertOptions, privateKey *rsa.PrivateKey) (*x509.CertificateRequest, error)
CreateCertReq creates a new x.509 certificate request for an existing private key.
func CreateCertReqWithKey ¶
func CreateCertReqWithKey(opts *CertOptions) (*x509.CertificateRequest, *rsa.PrivateKey, error)
CreateCertReqWithKey creates a new x.509 certificate request with a newly generated private key.
func InitCA ¶
func InitCA(opts *CertOptions, certOut, keyOut string) error
func LoadCertificate ¶
func LoadCertificate(filename string, osWrapper Oser) (*x509.Certificate, error)
LoadCertificate loads a single certificate from a file.
func LoadFromPEMFile ¶
LoadFromPEMFile loads certificate data from a PEM file.
func LoadPrivateKey ¶
func LoadPrivateKey(filename string, osWrapper Oser) (*rsa.PrivateKey, error)
LoadPrivateKey loads a single RSA private key from a file.
func LoadPublicKey ¶
LoadPublicKey loads a single RSA public key from a file.
func LoadRequest ¶
func LoadRequest(filename string, osWrapper Oser) (*x509.CertificateRequest, error)
LoadRequest loads a single certificate request from a file.
func MakeReq ¶
func MakeReq(opts *CertOptions, keyIn, keyOut, reqOut string) error
func SaveToPEMFile ¶
SaveToPEMFile saves certificate data to a PEM file.
func SignCertReq ¶
func SignCertReq(req *x509.CertificateRequest, ca *CA, opts *CertOptions) (*x509.Certificate, error)
SignCertReq signs a certificate request using a CA key.
Types ¶
type CA ¶
type CA struct { Certificate *x509.Certificate PrivateKey *rsa.PrivateKey }
CA contains internal data for a certificate authority.
type CertNames ¶
CertNames lists the subjectAltNames that can be assigned to a certificate or request.
func GetReqNames ¶
func GetReqNames(request *x509.CertificateRequest) (*CertNames, error)
GetReqNames returns the names coded into a certificate request, including Receptor node IDs.
type CertOptions ¶
type CertOptions struct { CertNames CommonName string Bits int NotBefore time.Time NotAfter time.Time }
CertOptions are the parameters used to initialize a new certificate or request.
type OsWrapper ¶ added in v1.4.6
type OsWrapper struct{}
OsWrapper is the Wrapper structure for Oser.
type Oser ¶ added in v1.4.6
type Oser interface { ReadFile(name string) ([]byte, error) WriteFile(name string, data []byte, perm fs.FileMode) error }
Oser is the function calls interfaces for mocking os.
type RsaWrapper ¶ added in v1.4.4
type RsaWrapper struct{}
RsaWrapper is the Wrapper structure for Rsaer.
func (*RsaWrapper) GenerateKey ¶ added in v1.4.4
func (rw *RsaWrapper) GenerateKey(random io.Reader, bits int) (*rsa.PrivateKey, error)
GenerateKey for RsaWrapper defaults to rsa library call.
Directories ¶
Path | Synopsis |
---|---|
Package mock_certificates is a generated GoMock package.
|
Package mock_certificates is a generated GoMock package. |