Documentation
¶
Overview ¶
Package cert provides a cryptographic certicate library.
Index ¶
- Constants
- func AddSignature(verifier Verifier, signature Signature, rawCert []byte) ([]byte, error)
- func GetCertified(rawCert []byte) ([]byte, error)
- func Sign(signer Signer, data []byte, expiration int64) ([]byte, error)
- func SignMulti(signer Signer, rawCert []byte) ([]byte, error)
- func Verify(verifier Verifier, rawCert []byte) ([]byte, error)
- func VerifyAll(verifiers []Verifier, rawCert []byte) ([]byte, error)
- func VerifyThreshold(verifiers []Verifier, threshold int, rawCert []byte) ([]byte, []Verifier, []Verifier, error)
- type Signature
- type Signer
- type Verifier
Constants ¶
const (
// CertVersion is the certificate format version.
CertVersion = 0
)
Variables ¶
This section is empty.
Functions ¶
func AddSignature ¶
AddSignature adds the signature to the certificate if the verifier can verify the signature signs the certificate.
func GetCertified ¶
GetCertified returns the certified data.
func SignMulti ¶
SignMulti uses the given signer to create a signature and appends it to the certificate and returns it.
func Verify ¶
Verify is used to verify one of the signatures attached to the certificate. It returns the certified data if the signature is valid.
func VerifyAll ¶
VerifyAll returns the certified data if all of the given verifiers can verify the certificate. Otherwise nil is returned along with an error.
func VerifyThreshold ¶
func VerifyThreshold(verifiers []Verifier, threshold int, rawCert []byte) ([]byte, []Verifier, []Verifier, error)
VerifyThreshold returns the certified data, the succeeded verifiers and the failed verifiers if at least a threshold number of verifiers can verify the certificate. Otherwise nil is returned along with an error.
Types ¶
type Signature ¶
type Signature struct {
// Identity is the identity of the signer.
Identity []byte
// Payload is the actual signature value.
Payload []byte
}
Signature is a cryptographic signature which has an associated signer ID.
func GetSignature ¶
GetSignature returns a signature that signs the certificate if it matches with the given identity.
func GetSignatures ¶
GetSignatures returns all the signatures.