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

Function EncodePrivateKey

crypto/kms/privatekeystore.go:130–140  ·  view source on GitHub ↗

EncodePrivateKey encode private to key to string format.

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

Source from the content-addressed store, hash-verified

128
129// EncodePrivateKey encode private to key to string format.
130func EncodePrivateKey(key *asymmetric.PrivateKey, masterKey []byte) (keyBytes []byte, err error) {
131 serializedKey := key.Serialize()
132 encKey, err := symmetric.EncryptWithPassword(serializedKey, masterKey, privateKDFSalt)
133 if err != nil {
134 return
135 }
136
137 keyBytes = []byte(base58.CheckEncode(encKey, PrivateKeyStoreVersion))
138
139 return
140}
141
142// SavePrivateKey saves private key with its hash on the head to keyFilePath,
143// default perm is 0600.

Callers 5

AddNewPrivateKeyFunction · 0.92
SavePrivateKeyFunction · 0.92
genKeyPairFunction · 0.92
downloadKeyPairFunction · 0.92
SavePrivateKeyFunction · 0.85

Calls 2

EncryptWithPasswordFunction · 0.92
SerializeMethod · 0.45

Tested by

no test coverage detected