-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstorage.go
75 lines (54 loc) · 1.59 KB
/
storage.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// storage.go - storage abstraction
//
// (c) 2018 Sudhi Herle; License GPLv2
//
// This software does not come with any express or implied
// warranty; it is provided "as is". No claim is made to its
// suitability for any purpose.
package pki
import (
"math/big"
"time"
)
// Storage abstracts the underlying persistent storage provider.
type Storage interface {
Rekey(newpw string) error
Close() error
// Get the Root CA
GetRootCA() (*Cert, error)
// Store root CA
StoreRootCA(*Cert) error
// Return current serial#
GetSerial() *big.Int
// increment serial#, update db and return new serial#
NewSerial() (*big.Int, error)
// get intermediate CA
GetICA(nm string) (*Cert, error)
// Fetch client cert
GetClientCert(nm string, pw string) (*Cert, error)
// Fetch server cert
GetServerCert(nm string, pw string) (*Cert, error)
// Store intermediate CA
StoreICA(c *Cert) error
// Store client cert
StoreClientCert(c *Cert, pw string) error
// Store server cert
StoreServerCert(c *Cert, pw string) error
// Delete a given CA -- revocation
DeleteICA(cn string) error
// Delete client cert
DeleteClientCert(cn string) error
// delete server cert
DeleteServerCert(cn string) error
// Export DB in portable JSON
ExportJSON() (string, error)
// XXX Do we need a MergeJSON() operation to merge data from
// a json blob?
// - Iterators -
MapICA(func(*Cert) error) error
MapClientCerts(func(*Cert) error) error
MapServerCerts(func(*Cert) error) error
MapRevoked(func(time.Time, *Cert)) error
FindRevoked(skid []byte) (time.Time, *Cert, error)
}
// vim: ft=go:noexpandtab:sw=8:ts=8