This CIP defines serialisation formats for the following types ofcryptographic keys across the Cardano eco-system:
Regular Ed25519 keys
BIP32-Ed25519 extended keys(Ed25519 extended keys with BIP32-style derivation)
Throughout the Cardano eco-system, different projects have used differentserialisation formats for cryptographic keys.
For example, for BIP32-Ed25519 extended signing keys, thecardano-crypto
implementation supports a 128-byte binary serialization format, whilejcli
andcardano-addresses
supports a 96-byte binary serialization format.
Another example would becardano-cli
whichsupports a custom JSON format, referred to as "text envelope", (which can beused for serialising keys) that isn't supported by other projects in theeco-system.
This has introduced compatibility problems for both users and developers:
Users cannot easily utilize their keys across different tools and softwarein the Cardano eco-system as they may be serialized in different ways.
Developers wanting to support the different serialisation formats may needto write potentially error-prone (de)serialisation and conversionoperations.
Therefore, this CIP aims to define standard cryptographic key serialisationformats to be used by projects throughout the Cardano eco-system.
For the verification (public) key binary format, we simply use the raw 32-byteEd25519 public key data.
This structure should be Bech32 encoded, using one of the appropriate*_vk
prefixes defined in CIP-0005.
For extended verification (public) keys, we define the following 64-bytebinary format:
+-----------------------+-----------------------+| Public Key (32 bytes) | Chain Code (32 bytes) |+-----------------------+-----------------------+
That is, a 32-byte Ed25519 public key followed by a 32-byte chain code.
This structure should be Bech32 encoded, using one of the appropriate*_xvk
prefixes defined in CIP-0005.
For the signing (private) key binary format, we simply use the raw 32-byteEd25519 private key data.
This structure should be Bech32 encoded, using one of the appropriate*_sk
prefixes defined in CIP-0005.
For extended signing (private) keys, we define the following 96-byte binaryformat:
+---------------------------------+-----------------------+| Extended Private Key (64 bytes) | Chain Code (32 bytes) |+---------------------------------+-----------------------+
That is, a 64-byte Ed25519 extended private key followed by a 32-byte chaincode.
This structure should be Bech32 encoded, using one of the appropriate*_xsk
prefixes defined in CIP-0005.
As mentioned in theAbstract, the originalcardano-crypto
implementation defined a 128-byte binary serialization format forBIP32-Ed25519 extended signing keys:
+---------------------------------+-----------------------+-----------------------+| Extended Private Key (64 bytes) | Public Key (32 bytes) | Chain Code (32 bytes) |+---------------------------------+-----------------------+-----------------------+
However, as it turns out, keeping around the 32-byte Ed25519 public key isredundant as it can easily be derived from the Ed25519 private key (the first32 bytes of the 64-byte extended private key).
Therefore, because other projects such asjcli
andcardano-addresses
already utilize the more compact 96-byte format, we opt to define that as thestandard.
N/A
This CIP is licensed underApache-2.0.