-
Notifications
You must be signed in to change notification settings - Fork 11
[WIP] Deterministic file and bucket keys #8
Conversation
Generate a twelve word mnemonic according to BIP 39 which gives 132 bits of entropy. This mnemonic will be encrypted into the keyring using the keyring's standard method of encryption. The bucket key is generated using pbkdf2 using the mnemonic as the password, the bucket id as the salt, and other settings already used by DataCipherKeyIv. The file key is generated similarly using the bucketKey as the password and fileId as the salt. This file key then becomes the secret password to a new DataCipherKeyIv. | ||
|
||
```javascript | ||
DataCipherKeyIv.getHDBucketKey = function(mnemonic, bucketId){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just deterministic correct? So this should be getDBucketKey
not getHDBucketKey
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still hierarchical in the sense that you have the seed -> bucketKey -> fileKey and sharing the bucketKey gives you access to all its fileKeys, but not access to the seed. Right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, wasn't there also a process of determining the fileId
? This may be separate SIP for generating a merkle root hash from all of the shards for the fileId
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that should probably be a separate SIP. It will depend on whether the benefits of doing that outway the convenience of being able to lookup an entry directly by user id, bucket name, and file name.
return buffer.toString('hex').substring(0, 64); | ||
}; | ||
|
||
DataCipherKeyIv.getHDFileKey = function(bucketKey, fileId){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Specification | ||
------------- | ||
|
||
Generate a twelve word mnemonic according to BIP 39 which gives 132 bits of entropy. This mnemonic will be encrypted into the keyring using the keyring's standard method of encryption. The bucket key is generated using pbkdf2 using the mnemonic as the password, the bucket id as the salt, and other settings already used by DataCipherKeyIv. The file key is generated similarly using the bucketKey as the password and fileId as the salt. This file key then becomes the secret password to a new DataCipherKeyIv. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be useful to include some rationale for why pbkdf2 is used here against the alternatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I used it mainly because is already used in CipherKeyIV. Since we are hashing long, generated passwords, not weak user provided passwords, just about any hash would probably work fine.
Specification | ||
------------- | ||
|
||
Generate a twelve word mnemonic according to BIP 39 which gives 132 bits of entropy. This mnemonic will be encrypted into the keyring using the keyring's standard method of encryption. The bucket key is generated using pbkdf2 using the mnemonic as the password, the bucket id as the salt, and other settings already used by DataCipherKeyIv. The file key is generated similarly using the bucketKey as the password and fileId as the salt. This file key then becomes the secret password to a new DataCipherKeyIv. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also is the mnemonic converted to a seed? And that seed used? It may also be useful to separate the mnemonic from derivation. e.g. A master secret, which all symmetric keys are derived. And there is a process of generating master secret from a mnemonic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, I'm using the mnemonic directly because it's simpler to implement. I can't think of any downsides to doing it that way since pbkdf2 can take arbitrarily long passwords. We could hash the mnemonic and store that, but then there wouldn't be an easy way to convert that value back to a mnemonic for easier key transfer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds more like a long pass phrase than BIP39 ;) For example, the mnemonic last keyword is part of a checksum, and a few other details. The mnemonic can be stored instead of the seed to solve problem of transferring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
I think it would still be a good idea to use BIP38 here, as we may want to have a mnemonic that would be for both encryption and other purposes with BIP32 derivation. |
That just sounds like just deterministic keys to me. Hierarchical keys On Oct 22, 2016 12:03 PM, "Chris Pollard" notifications@github.com wrote:
|
Doesn't look like this is going to be finished or maintained. Closing. |
Deterministic file and bucket key description.