Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
trees
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Liberate
trees
Commits
cc048ab9
Commit
cc048ab9
authored
7 years ago
by
matthias
Browse files
Options
Downloads
Patches
Plain Diff
add option to change password for locked_secretbox in trees-create
parent
ed0bbfb2
No related branches found
No related tags found
1 merge request
!4
Fix for #17 build issue with libsodium <= 1.0.14 and password change option for trees-create
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/trees-create
+31
-9
31 additions, 9 deletions
bin/trees-create
with
31 additions
and
9 deletions
bin/trees-create
+
31
−
9
View file @
cc048ab9
...
...
@@ -27,6 +27,7 @@ end
def
usage
puts
"USAGE:"
puts
" trees-create --password PASSWORD [OPTIONS]"
puts
" trees-create --password PASSWORD --old-password PASSWORD OPTIONS"
puts
puts
"OPTIONS may include:"
puts
" --opslimit OPSLIMIT -- argon2 ops limit, integer in 3..10, or one of"
...
...
@@ -37,6 +38,9 @@ def usage
puts
"
#{
StorageKey
::
SALT_BYTES
}
bytes in length"
puts
" --nonce NONCE -- hex encoded nonce for secretbox encryption of"
puts
" private key,
#{
StorageKey
::
NONCE_BYTES
}
bytes in length"
puts
" --secretbox SECRETBOX -- hex encoded secretbox"
puts
puts
"for password change all options are required"
exit
1
end
...
...
@@ -46,6 +50,9 @@ def main
while
ARGV
.
any?
case
ARGV
.
first
when
"--old-password"
ARGV
.
shift
old_password
=
ARGV
.
shift
when
"--password"
ARGV
.
shift
password
=
ARGV
.
shift
...
...
@@ -61,12 +68,19 @@ def main
when
"--nonce"
ARGV
.
shift
st
.
sk_nonce
=
ARGV
.
shift
when
"--secretbox"
ARGV
.
shift
st
.
locked_secretbox
=
ARGV
.
shift
else
usage
end
end
usage
unless
password
if
old_password
.
nil?
st
.
generate_new_keypair
(
password
)
else
st
.
change_password
(
old_password
,
password
)
end
puts
st
.
to_s
end
...
...
@@ -121,6 +135,14 @@ class StorageKey
)
end
def
change_password
(
old_password
,
password
)
key
=
self
.
decrypt_key
(
old_password
)
self
.
encrypt_key
(
key:
key
,
password:
password
)
end
def
to_s
attrs
=
[
:public_key
,
:locked_secretbox
,
:sk_nonce
,
:pwhash_opslimit
,
:pwhash_memlimit
,
:pwhash_salt
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment