MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / SavePrivateKey

Function SavePrivateKey

crypto/kms/privatekeystore.go:144–152  ·  view source on GitHub ↗

SavePrivateKey saves private key with its hash on the head to keyFilePath, default perm is 0600.

(keyFilePath string, key *asymmetric.PrivateKey, masterKey []byte)

Source from the content-addressed store, hash-verified

142// SavePrivateKey saves private key with its hash on the head to keyFilePath,
143// default perm is 0600.
144func SavePrivateKey(keyFilePath string, key *asymmetric.PrivateKey, masterKey []byte) (err error) {
145 var keyBytes []byte
146 keyBytes, err = EncodePrivateKey(key, masterKey)
147 if err != nil {
148 return
149 }
150
151 return ioutil.WriteFile(keyFilePath, keyBytes, 0600)
152}
153
154// InitLocalKeyPair initializes local private key.
155func InitLocalKeyPair(privateKeyPath string, masterKey []byte) (err error) {

Callers 6

setupFunction · 0.92
setupFunction · 0.92
runGenerateFunction · 0.92
InitLocalKeyPairFunction · 0.70
TestSaveLoadPrivateKeyFunction · 0.70
TestLoadPrivateKeyFunction · 0.70

Calls 1

EncodePrivateKeyFunction · 0.85

Tested by 4

setupFunction · 0.74
setupFunction · 0.74
TestSaveLoadPrivateKeyFunction · 0.56
TestLoadPrivateKeyFunction · 0.56