Skip to content

Passphrase protected key store spec

Gustav Simonsson edited this page Apr 28, 2015 · 19 revisions

Summary

This page details the crypto & encodings in the passphrase protected key store in Go. To implement this in another Ethereum implementation the steps below can be followed. The example JSON also acts as a test vector.

References

Go source code & cryptography notes: https://github.com/Gustav-Simonsson/go-ethereum/blob/improve_key_store_crypto/crypto/key_store_passphrase.go#L29

The source code comments there also have a list of further references.

From JSON to privkey

We start with the JSON in the key file on disk and list operations to get a privkey for signing.

JSON in key file on disk:

{
    "Address": "d4584b5f6229b7be90727b0fc8c6b91bb427821f",
    "Crypto": {
        "CipherText": "07533e172414bfa50e99dba4a0ce603f654ebfa1ff46277c3e0c577fdc87f6bb4e4fe16c5a94ce6ce14cfa069821ef9b",
        "IV": "16d67ba0ce5a339ff2f07951253e6ba8",
        "KeyHeader": {
            "Kdf": "scrypt",
            "KdfParams": {
                "DkLen": 32,
                "N": 262144,
                "P": 1,
                "R": 8,
                "SaltLen": 32
            },
            "Version": "1"
        },
        "MAC": "8ccded24da2e99a11d48cda146f9cc8213eb423e2ea0d8427f41c3be414424dd",
        "Salt": "06870e5e6a24e183a5c807bd1c43afd86d573f7db303ff4853d135cd0fd3fe91"
    },
    "Id": "0498f19a-59db-4d54-ac95-33901b4f1870",
    "Version": "1"
}
Clone this wiki locally