Documentation
¶
Index ¶
- Variables
- func CertificateSerialNumber(data string) (string, error)
- func IsCertificateExpired(data string) (bool, error)
- func IsCertificateValid(data string, now time.Time) (bool, error)
- func ProcessSign(process *process.Process) interface{}
- func ProcessVerify(process *process.Process) interface{}
- func Sign(data []byte, cert *Certificate, algorithm string) ([]byte, error)
- func SignBase64(data []byte, cert *Certificate, algorithm string) (string, error)
- func SignHexBase64(data string, cert *Certificate, algorithm string) (string, error)
- func SignStrBase64(data string, cert *Certificate, algorithm string) (string, error)
- func Verify(data []byte, signature []byte, cert *Certificate, algorithm string) (bool, error)
- func VerifyBase64(data []byte, signature string, cert *Certificate, algorithm string) (bool, error)
- func VerifyHexBase64(data string, signature string, cert *Certificate, algorithm string) (bool, error)
- func VerifyStrBase64(data string, signature string, cert *Certificate, algorithm string) (bool, error)
- type Certificate
Constants ¶
This section is empty.
Variables ¶
var Certificates = map[string]*Certificate{}
Certificates loaded
Functions ¶
func CertificateSerialNumber ¶
CertificateSerialNumber get the SN of the certificate
func IsCertificateExpired ¶
IsCertificateExpired check if the certificate was expired
func IsCertificateValid ¶
IsCertificateValid check if the certificate is expired at time
func ProcessSign ¶
ProcessSign computes a signature for the specified data by generating a cryptographic digital signature
func ProcessVerify ¶
ProcessVerify verifies that the signature is correct for the specified data
func Sign ¶
func Sign(data []byte, cert *Certificate, algorithm string) ([]byte, error)
Sign computes a signature for the specified data by generating a cryptographic digital signature using the private key associated with private_key.
func SignBase64 ¶
func SignBase64(data []byte, cert *Certificate, algorithm string) (string, error)
SignBase64 Generate signature
func SignHexBase64 ¶
func SignHexBase64(data string, cert *Certificate, algorithm string) (string, error)
SignHexBase64 Generate signature
func SignStrBase64 ¶
func SignStrBase64(data string, cert *Certificate, algorithm string) (string, error)
SignStrBase64 Generate signature
func Verify ¶
Verify verifies that the signature is correct for the specified data using the public key associated with public_key. This must be the public key corresponding to the private key used for signing.
func VerifyBase64 ¶
VerifyBase64 Verify signature
func VerifyHexBase64 ¶
func VerifyHexBase64(data string, signature string, cert *Certificate, algorithm string) (bool, error)
VerifyHexBase64 Verify signature
func VerifyStrBase64 ¶
func VerifyStrBase64(data string, signature string, cert *Certificate, algorithm string) (bool, error)
VerifyStrBase64 Verify signature
Types ¶
type Certificate ¶
type Certificate struct {
Type string
Format string // PEM
// contains filtered or unexported fields
}
Certificate the ssl Certificate
func Load ¶ added in v0.10.3
func Load(file string, name string) (*Certificate, error)
Load Load the certificate from the given file
func LoadCertificate ¶
func LoadCertificate(data []byte, name string) (*Certificate, error)
LoadCertificate load the certificate from the given file
func NewCertificate ¶
func NewCertificate(data []byte) (*Certificate, error)
NewCertificate creat a new certificate from file