-
Notifications
You must be signed in to change notification settings - Fork 34
/
cr.go
39 lines (35 loc) · 1.07 KB
/
cr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// simplecert
//
// Created by Philipp Mieden
// Contact: dreadl0ck@protonmail.ch
// Copyright © 2018 bestbytes. All rights reserved.
//
package simplecert
import (
"github.com/go-acme/lego/v4/certificate"
)
// CR represents an ACME Certificate Resource
// It can be persisted on the FileSystem with all fields
// which cannot be done with acme.CertificateResource
type CR struct {
Domain string `json:"domain"`
CertURL string `json:"certUrl"`
CertStableURL string `json:"certStableUrl"`
PrivateKey []byte `json:"privateKey"`
Certificate []byte `json:"certificate"`
IssuerCertificate []byte `json:"issuerCertificate"`
CSR []byte `json:"csr"`
}
// get an ACME certificate resource from CR
func getACMECertResource(cr CR) *certificate.Resource {
var cert = new(certificate.Resource)
cert.Domain = cr.Domain
cert.CertURL = cr.CertURL
cert.CertStableURL = cr.CertStableURL
cert.PrivateKey = cr.PrivateKey
cert.Certificate = cr.Certificate
cert.IssuerCertificate = cr.IssuerCertificate
cert.CSR = cr.CSR
return cert
}