mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 00:09:31 +01:00
wallet.proto: rename to Key.Type.ENCRYPTED from ENCRYPTED_SCRYPT_AES
This commit is contained in:
parent
92c2c29508
commit
70fb77d2d1
2 changed files with 11 additions and 4 deletions
|
@ -361,7 +361,7 @@ public class BasicKeyChain implements EncryptableKeyChain {
|
||||||
.setInitialisationVector(ByteString.copyFrom(data.initialisationVector)));
|
.setInitialisationVector(ByteString.copyFrom(data.initialisationVector)));
|
||||||
// We don't allow mixing of encryption types at the moment.
|
// We don't allow mixing of encryption types at the moment.
|
||||||
checkState(item.getEncryptionType() == Protos.Wallet.EncryptionType.ENCRYPTED_SCRYPT_AES);
|
checkState(item.getEncryptionType() == Protos.Wallet.EncryptionType.ENCRYPTED_SCRYPT_AES);
|
||||||
proto.setType(Protos.Key.Type.ENCRYPTED_SCRYPT_AES);
|
proto.setType(Protos.Key.Type.ENCRYPTED);
|
||||||
} else {
|
} else {
|
||||||
final byte[] secret = item.getSecretBytes();
|
final byte[] secret = item.getSecretBytes();
|
||||||
// The secret might be missing in the case of a watching wallet, or a key for which the private key
|
// The secret might be missing in the case of a watching wallet, or a key for which the private key
|
||||||
|
@ -401,9 +401,9 @@ public class BasicKeyChain implements EncryptableKeyChain {
|
||||||
checkState(hashToKeys.isEmpty(), () ->
|
checkState(hashToKeys.isEmpty(), () ->
|
||||||
"tried to deserialize into a non-empty chain");
|
"tried to deserialize into a non-empty chain");
|
||||||
for (Protos.Key key : keys) {
|
for (Protos.Key key : keys) {
|
||||||
if (key.getType() != Protos.Key.Type.ORIGINAL && key.getType() != Protos.Key.Type.ENCRYPTED_SCRYPT_AES)
|
if (key.getType() != Protos.Key.Type.ORIGINAL && key.getType() != Protos.Key.Type.ENCRYPTED)
|
||||||
continue;
|
continue;
|
||||||
boolean encrypted = key.getType() == Protos.Key.Type.ENCRYPTED_SCRYPT_AES;
|
boolean encrypted = key.getType() == Protos.Key.Type.ENCRYPTED;
|
||||||
byte[] priv = key.hasSecretBytes() ? key.getSecretBytes().toByteArray() : null;
|
byte[] priv = key.hasSecretBytes() ? key.getSecretBytes().toByteArray() : null;
|
||||||
if (!key.hasPublicKey())
|
if (!key.hasPublicKey())
|
||||||
throw new UnreadableWalletException("Public key missing");
|
throw new UnreadableWalletException("Public key missing");
|
||||||
|
|
|
@ -86,11 +86,18 @@ message DeterministicKey {
|
||||||
*/
|
*/
|
||||||
message Key {
|
message Key {
|
||||||
enum Type {
|
enum Type {
|
||||||
|
option allow_alias = true;
|
||||||
/** Unencrypted - Original bitcoin secp256k1 curve */
|
/** Unencrypted - Original bitcoin secp256k1 curve */
|
||||||
ORIGINAL = 1;
|
ORIGINAL = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encrypted - Original bitcoin secp256k1 curve
|
||||||
|
* Details of the encryption are declared via Wallet.EncryptionType enum
|
||||||
|
*/
|
||||||
|
ENCRYPTED = 2;
|
||||||
|
|
||||||
/** Encrypted with Scrypt and AES - Original bitcoin secp256k1 curve */
|
/** Encrypted with Scrypt and AES - Original bitcoin secp256k1 curve */
|
||||||
ENCRYPTED_SCRYPT_AES = 2;
|
ENCRYPTED_SCRYPT_AES = 2 [deprecated = true];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not really a key, but rather contains the mnemonic phrase for a deterministic key hierarchy in the private_key field.
|
* Not really a key, but rather contains the mnemonic phrase for a deterministic key hierarchy in the private_key field.
|
||||||
|
|
Loading…
Add table
Reference in a new issue