@@ -63,6 +63,9 @@ enum KeyType {
6363 Ed25519 = 1;
6464 Secp256k1 = 2;
6565 ECDSA = 3;
66+
67+ PKIX = 0x40;
68+ PKCS8 = 0x41;
6669}
6770
6871message PublicKey {
@@ -110,11 +113,13 @@ The second is for generating peer ids; this is discussed in the section below.
110113
111114### Key Types
112115
113- Four key types are supported:
116+ The following key types are supported:
114117 - RSA
115118 - Ed25519
116119 - Secp256k1
117120 - ECDSA
121+ - PKIX Encoded Public Keys
122+ - PKCS #8 Encoded Private Keys
118123
119124Implementations MUST support Ed25519. Implementations SHOULD support RSA if they wish to
120125interoperate with the mainline IPFS DHT and the default IPFS bootstrap nodes. Implementations MAY
@@ -185,6 +190,27 @@ To sign a message, we hash the message with SHA 256, and then sign it with the
185190[ ECDSA standard algorithm] ( https://tools.ietf.org/html/rfc6979 ) , then we encode
186191it using [ DER-encoded ASN.1.] ( https://wiki.openssl.org/index.php/DER )
187192
193+ #### PKIX Public Keys
194+
195+ The PKIX key type only encodes public keys. The Data field is the [ PKIX
196+ encoding] ( https://www.rfc-editor.org/rfc/rfc5280 ) of the public key. The public
197+ key and algorithm are identified by the [ Subject Public Key
198+ Info] ( https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.7 ) field.
199+
200+ Signature Verification is defined by the key algorithm used.
201+
202+ For backwards compatibility, if a key algorithm has a prior libp2p specific encoding, implementers SHOULD prefer that.
203+
204+ #### PKCS #8 Private Keys
205+
206+ The PKCS8 key type primarily encodes private keys, but may include the
207+ corresponding public key. The Data field is the [ PKCS #8
208+ encoding] ( https://www.rfc-editor.org/rfc/rfc5958.html ) of the private key.
209+
210+ Signing is defined by the key algorithm used.
211+
212+ For backwards compatibility, if a key algorithm has a prior libp2p specific encoding, implementers SHOULD prefer that.
213+
188214### Test vectors
189215
190216The following test vectors are hex-encoded bytes of the above described protobuf encoding.
0 commit comments