Documentation ¶
Index ¶
- Variables
- func ArmorInfoBytes(bz []byte) string
- func ArmorPubKeyBytes(bz []byte) string
- func DecryptAESGCM(key []byte, enBytes []byte) ([]byte, error)
- func EncryptAESGCM(key []byte, src []byte) ([]byte, error)
- func EncryptArmorPrivKey(privKey posCrypto.PrivateKey, passphrase, hint string) (string, error)
- func UnarmorDecryptPrivKey(armorStr string, passphrase string) (posCrypto.PrivateKey, error)
- func UnarmorInfoBytes(armorStr string) (bz []byte, err error)
- func UnarmorPubKeyBytes(armorStr string) (bz []byte, err error)
- type ArmoredJson
Constants ¶
This section is empty.
Variables ¶
var BcryptSecurityParameter = 12
Make bcrypt security parameter var, so it can be changed within the lcd test Making the bcrypt security parameter a var shouldn't be a security issue: One can't verify an invalid key by maliciously changing the bcrypt parameter during a runtime vulnerability. The main security threat this then exposes would be something that changes this during runtime before the user creates their key. This vulnerability must succeed to update this to that same value before every subsequent call to the keys command in future startups / or the attacker must get access to the filesystem. However, with a similar threat model (changing variables in runtime), one can cause the user to sign a different tx than what they see, which is a significantly cheaper attack then breaking a bcrypt hash. (Recall that the nonce still exists to break rainbow tables) For further notes on security parameter choice, see README.md
Functions ¶
func EncryptArmorPrivKey ¶
func EncryptArmorPrivKey(privKey posCrypto.PrivateKey, passphrase, hint string) (string, error)
Encrypt and armor the private key.
func UnarmorDecryptPrivKey ¶
func UnarmorDecryptPrivKey(armorStr string, passphrase string) (posCrypto.PrivateKey, error)
Unarmor and decrypt the private key.
func UnarmorInfoBytes ¶
Unarmor the InfoBytes
func UnarmorPubKeyBytes ¶
Unarmor the PubKeyBytes
Types ¶
type ArmoredJson ¶
type ArmoredJson struct { Kdf string `json:"kdf" yaml:"kdf"` Salt string `json:"salt" yaml:"salt"` SecParam string `json:"secparam" yaml:"secparam"` Hint string `json:"hint" yaml:"hint"` Ciphertext string `json:"ciphertext" yaml:"ciphertext"` }
----------------------------------------------------------------- encrypt/decrypt with armor
func NewArmoredJson ¶
func NewArmoredJson(kdf, salt, hint, ciphertext string) ArmoredJson