Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bdepasswords
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
BDE
Bdepasswords
Commits
525eca4f
Commit
525eca4f
authored
11 years ago
by
Vincent Le gallic
Browse files
Options
Downloads
Patches
Plain Diff
oubli : gpg() a aussi besoin de options.
parent
517cb1e7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client.py
+9
-9
9 additions, 9 deletions
client.py
with
9 additions
and
9 deletions
client.py
+
9
−
9
View file @
525eca4f
...
...
@@ -79,7 +79,7 @@ GPG_TRUSTLEVELS = {
u
"
q
"
:
(
u
"
non définie
"
,
False
),
}
def
gpg
(
command
,
args
=
None
):
def
gpg
(
options
,
command
,
args
=
None
):
"""
Lance gpg pour la commande donnée avec les arguments
donnés. Renvoie son entrée standard et sa sortie standard.
"""
full_command
=
[
GPG
]
...
...
@@ -319,7 +319,7 @@ def update_keys(options):
keys
=
all_keys
(
options
)
_
,
stdout
=
gpg
(
"
receive-keys
"
,
[
key
for
_
,
key
in
keys
.
values
()
if
key
])
_
,
stdout
=
gpg
(
options
,
"
receive-keys
"
,
[
key
for
_
,
key
in
keys
.
values
()
if
key
])
return
stdout
.
read
().
decode
(
"
utf-8
"
)
def
check_keys
(
options
,
recipients
=
None
,
quiet
=
False
):
...
...
@@ -341,7 +341,7 @@ def check_keys(options, recipients=None, quiet=False):
keys
=
{
u
:
val
for
(
u
,
val
)
in
keys
.
iteritems
()
if
u
in
recipients
}
if
speak
:
print
(
"
M : le mail correspond à un uid du fingerprint
\n
C : confiance OK (inclut la vérification de non expiration).
\n
"
)
_
,
gpgout
=
gpg
(
'
list-keys
'
)
_
,
gpgout
=
gpg
(
options
,
'
list-keys
'
)
localring
=
parse_keys
(
gpgout
)
for
(
recipient
,
(
mail
,
fpr
))
in
keys
.
iteritems
():
failed
=
u
""
...
...
@@ -419,7 +419,7 @@ def encrypt(options, roles, contents):
fpr_recipients
.
append
(
"
-r
"
)
fpr_recipients
.
append
(
fpr
)
stdin
,
stdout
=
gpg
(
"
encrypt
"
,
fpr_recipients
)
stdin
,
stdout
=
gpg
(
options
,
"
encrypt
"
,
fpr_recipients
)
stdin
.
write
(
contents
.
encode
(
"
utf-8
"
))
stdin
.
close
()
out
=
stdout
.
read
().
decode
(
"
utf-8
"
)
...
...
@@ -428,9 +428,9 @@ def encrypt(options, roles, contents):
else
:
return
[
True
,
out
]
def
decrypt
(
contents
):
def
decrypt
(
options
,
contents
):
"""
Déchiffre le contenu
"""
stdin
,
stdout
=
gpg
(
"
decrypt
"
)
stdin
,
stdout
=
gpg
(
options
,
"
decrypt
"
)
stdin
.
write
(
contents
.
encode
(
"
utf-8
"
))
stdin
.
close
()
return
stdout
.
read
().
decode
(
"
utf-8
"
)
...
...
@@ -539,7 +539,7 @@ def show_file(options):
print
(
value
.
encode
(
"
utf-8
"
))
# value contient le message d'erreur
return
passfile
=
value
(
sin
,
sout
)
=
gpg
(
'
decrypt
'
)
(
sin
,
sout
)
=
gpg
(
options
,
'
decrypt
'
)
sin
.
write
(
passfile
[
'
contents
'
].
encode
(
"
utf-8
"
))
sin
.
close
()
texte
=
sout
.
read
().
decode
(
"
utf-8
"
)
...
...
@@ -593,7 +593,7 @@ Enregistrez le fichier vide pour annuler.\n"""
return
else
:
passfile
=
value
(
sin
,
sout
)
=
gpg
(
'
decrypt
'
)
(
sin
,
sout
)
=
gpg
(
options
,
'
decrypt
'
)
sin
.
write
(
passfile
[
'
contents
'
].
encode
(
"
utf-8
"
))
sin
.
close
()
texte
=
sout
.
read
().
decode
(
"
utf-8
"
)
...
...
@@ -693,7 +693,7 @@ def recrypt_files(options):
# On rechiffre
to_put
=
[{
'
filename
'
:
f
[
'
filename
'
],
'
roles
'
:
f
[
'
roles
'
],
'
contents
'
:
encrypt
(
options
,
f
[
'
roles
'
],
decrypt
(
f
[
'
contents
'
]))}
'
contents
'
:
encrypt
(
options
,
f
[
'
roles
'
],
decrypt
(
options
,
f
[
'
contents
'
]))}
for
f
in
files
]
if
to_put
:
if
not
options
.
quiet
:
...
...
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