Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
45b75351
Unverified
Commit
45b75351
authored
Jun 08, 2020
by
libby kent
Committed by
GitHub
Jun 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/ethkey: support --passwordfile in generate command (#21183)
parent
da065193
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
6 deletions
+6
-6
changepassword.go
cmd/ethkey/changepassword.go
+1
-1
generate.go
cmd/ethkey/generate.go
+1
-1
inspect.go
cmd/ethkey/inspect.go
+1
-1
message.go
cmd/ethkey/message.go
+1
-1
utils.go
cmd/ethkey/utils.go
+2
-2
No files found.
cmd/ethkey/changepassword.go
View file @
45b75351
...
@@ -51,7 +51,7 @@ Change the password of a keyfile.`,
...
@@ -51,7 +51,7 @@ Change the password of a keyfile.`,
}
}
// Decrypt key with passphrase.
// Decrypt key with passphrase.
passphrase
:=
getPassphrase
(
ctx
)
passphrase
:=
getPassphrase
(
ctx
,
false
)
key
,
err
:=
keystore
.
DecryptKey
(
keyjson
,
passphrase
)
key
,
err
:=
keystore
.
DecryptKey
(
keyjson
,
passphrase
)
if
err
!=
nil
{
if
err
!=
nil
{
utils
.
Fatalf
(
"Error decrypting key: %v"
,
err
)
utils
.
Fatalf
(
"Error decrypting key: %v"
,
err
)
...
...
cmd/ethkey/generate.go
View file @
45b75351
...
@@ -94,7 +94,7 @@ If you want to encrypt an existing private key, it can be specified by setting
...
@@ -94,7 +94,7 @@ If you want to encrypt an existing private key, it can be specified by setting
}
}
// Encrypt key with passphrase.
// Encrypt key with passphrase.
passphrase
:=
promptPassphrase
(
true
)
passphrase
:=
getPassphrase
(
ctx
,
true
)
scryptN
,
scryptP
:=
keystore
.
StandardScryptN
,
keystore
.
StandardScryptP
scryptN
,
scryptP
:=
keystore
.
StandardScryptN
,
keystore
.
StandardScryptP
if
ctx
.
Bool
(
"lightkdf"
)
{
if
ctx
.
Bool
(
"lightkdf"
)
{
scryptN
,
scryptP
=
keystore
.
LightScryptN
,
keystore
.
LightScryptP
scryptN
,
scryptP
=
keystore
.
LightScryptN
,
keystore
.
LightScryptP
...
...
cmd/ethkey/inspect.go
View file @
45b75351
...
@@ -60,7 +60,7 @@ make sure to use this feature with great caution!`,
...
@@ -60,7 +60,7 @@ make sure to use this feature with great caution!`,
}
}
// Decrypt key with passphrase.
// Decrypt key with passphrase.
passphrase
:=
getPassphrase
(
ctx
)
passphrase
:=
getPassphrase
(
ctx
,
false
)
key
,
err
:=
keystore
.
DecryptKey
(
keyjson
,
passphrase
)
key
,
err
:=
keystore
.
DecryptKey
(
keyjson
,
passphrase
)
if
err
!=
nil
{
if
err
!=
nil
{
utils
.
Fatalf
(
"Error decrypting key: %v"
,
err
)
utils
.
Fatalf
(
"Error decrypting key: %v"
,
err
)
...
...
cmd/ethkey/message.go
View file @
45b75351
...
@@ -62,7 +62,7 @@ To sign a message contained in a file, use the --msgfile flag.
...
@@ -62,7 +62,7 @@ To sign a message contained in a file, use the --msgfile flag.
}
}
// Decrypt key with passphrase.
// Decrypt key with passphrase.
passphrase
:=
getPassphrase
(
ctx
)
passphrase
:=
getPassphrase
(
ctx
,
false
)
key
,
err
:=
keystore
.
DecryptKey
(
keyjson
,
passphrase
)
key
,
err
:=
keystore
.
DecryptKey
(
keyjson
,
passphrase
)
if
err
!=
nil
{
if
err
!=
nil
{
utils
.
Fatalf
(
"Error decrypting key: %v"
,
err
)
utils
.
Fatalf
(
"Error decrypting key: %v"
,
err
)
...
...
cmd/ethkey/utils.go
View file @
45b75351
...
@@ -52,7 +52,7 @@ func promptPassphrase(confirmation bool) string {
...
@@ -52,7 +52,7 @@ func promptPassphrase(confirmation bool) string {
// getPassphrase obtains a passphrase given by the user. It first checks the
// getPassphrase obtains a passphrase given by the user. It first checks the
// --passfile command line flag and ultimately prompts the user for a
// --passfile command line flag and ultimately prompts the user for a
// passphrase.
// passphrase.
func
getPassphrase
(
ctx
*
cli
.
Context
)
string
{
func
getPassphrase
(
ctx
*
cli
.
Context
,
confirmation
bool
)
string
{
// Look for the --passwordfile flag.
// Look for the --passwordfile flag.
passphraseFile
:=
ctx
.
String
(
passphraseFlag
.
Name
)
passphraseFile
:=
ctx
.
String
(
passphraseFlag
.
Name
)
if
passphraseFile
!=
""
{
if
passphraseFile
!=
""
{
...
@@ -65,7 +65,7 @@ func getPassphrase(ctx *cli.Context) string {
...
@@ -65,7 +65,7 @@ func getPassphrase(ctx *cli.Context) string {
}
}
// Otherwise prompt the user for the passphrase.
// Otherwise prompt the user for the passphrase.
return
promptPassphrase
(
false
)
return
promptPassphrase
(
confirmation
)
}
}
// signHash is a helper function that calculates a hash for the given message
// signHash is a helper function that calculates a hash for the given message
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment