-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcertmanager.go
27 lines (21 loc) · 978 Bytes
/
certmanager.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
package gomat
import (
"crypto/ecdsa"
"crypto/x509"
)
// matter certificate manager interface
// all generated certificates must be compatible with matter
// - this means that after they are reencoded to matter format and back their signature must match
type CertificateManager interface {
GetCaPublicKey() ecdsa.PublicKey
GetCaCertificate() *x509.Certificate
// CreateUser creates keys and certificate for node with specific id
// it must be possible to later retrieve node keys using GetPrivkey and certificate using GetCertificate
CreateUser(node_id uint64) error
// retrieve certificate of specified node (previously created by CreateUser)
GetCertificate(id uint64) (*x509.Certificate, error)
// retrieve key of specified node (previously created by CreateUser)
GetPrivkey(id uint64) (*ecdsa.PrivateKey, error)
// create and sign certificate using local CA keys
SignCertificate(user_pubkey *ecdsa.PublicKey, node_id uint64) (*x509.Certificate, error)
}