Debian Codegraph @

certstore/certstore.go

raw symbols SCIP
1 package certstore
2
3 import (
4 "crypto"
5 "crypto/x509"
6 "errors"
7 )
8
9 var (
10 // ErrUnsupportedHash is returned by Signer.Sign() when the provided hash
11 // algorithm isn't supported.
12 ErrUnsupportedHash = errors.New("unsupported hash algorithm")
13 )
14
15 // Open opens the system's certificate store.
16 func Open() (Store, error) {
17 return openStore()
18 }
19
20 // Store represents the system's certificate store.
21 type Store interface {
22 // Identities gets a list of identities from the store.
23 Identities() ([]Identity, error)
24
25 // Import imports a PKCS#12 (PFX) blob containing a certificate and private
26 // key.
27 Import(data []byte, password string) error
28
29 // Close closes the store.
30 Close()
31 }
32
33 // Identity is a X.509 certificate and its corresponding private key.
34 type Identity interface {
35 // Certificate gets the identity's certificate.
36 Certificate() (*x509.Certificate, error)
37
38 // CertificateChain attempts to get the identity's full certificate chain.
39 CertificateChain() ([]*x509.Certificate, error)
40
41 // Signer gets a crypto.Signer that uses the identity's private key.
42 Signer() (crypto.Signer, error)
43
44 // Delete deletes this identity from the system.
45 Delete() error
46
47 // Close any manually managed memory held by the Identity.
48 Close()
49 }