mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-23 13:57:52 +00:00
check if we have the public share key
This commit is contained in:
parent
ba297c3d7d
commit
d477a8a939
3 changed files with 12 additions and 2 deletions
|
@ -66,6 +66,11 @@ module MPW
|
||||||
@error_msg = I18n.t('error.config.key_bad_format')
|
@error_msg = I18n.t('error.config.key_bad_format')
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if !check_gpg_key?(k, false)
|
||||||
|
@error_msg = I18n.t('error.config.no_key_public', :key => k)
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -166,10 +171,11 @@ module MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if private key exist
|
# Check if private key exist
|
||||||
|
# @args: only_private -> search only private key
|
||||||
# @rtrn: true if the key exist, else false
|
# @rtrn: true if the key exist, else false
|
||||||
def check_gpg_key?
|
def check_gpg_key?(key = @key, only_private = true)
|
||||||
ctx = GPGME::Ctx.new
|
ctx = GPGME::Ctx.new
|
||||||
ctx.each_key(@key, true) do |key|
|
ctx.each_key(key, only_private) do
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ en:
|
||||||
write: "Can't write the config file!"
|
write: "Can't write the config file!"
|
||||||
check: "Checkconfig failed!"
|
check: "Checkconfig failed!"
|
||||||
key_bad_format: "The key string isn't in good format!"
|
key_bad_format: "The key string isn't in good format!"
|
||||||
|
no_key_public: "You haven't the public key of %{key}!"
|
||||||
genkey_gpg:
|
genkey_gpg:
|
||||||
exception: "Can't create the GPG key!"
|
exception: "Can't create the GPG key!"
|
||||||
name: "You must define a name for your GPG key!"
|
name: "You must define a name for your GPG key!"
|
||||||
|
@ -90,6 +91,7 @@ en:
|
||||||
length: "Size of the GPG key [default=2048]: "
|
length: "Size of the GPG key [default=2048]: "
|
||||||
expire: "Expire time of the GPG key [default=0 (unlimited)]: "
|
expire: "Expire time of the GPG key [default=0 (unlimited)]: "
|
||||||
wait: "Please waiting during the GPG key generate, this process can take few minutes."
|
wait: "Please waiting during the GPG key generate, this process can take few minutes."
|
||||||
|
valid: "Your GPG key has been created ;-)"
|
||||||
update:
|
update:
|
||||||
title: "Update an item"
|
title: "Update an item"
|
||||||
name: "Enter the name [%{name}]: "
|
name: "Enter the name [%{name}]: "
|
||||||
|
|
|
@ -5,6 +5,7 @@ fr:
|
||||||
write: "Impossible d'écrire le fichier de configuration!"
|
write: "Impossible d'écrire le fichier de configuration!"
|
||||||
check: "Le fichier de configuration est invalide!"
|
check: "Le fichier de configuration est invalide!"
|
||||||
key_bad_format: "La clé GPG est invalide!"
|
key_bad_format: "La clé GPG est invalide!"
|
||||||
|
no_key_public: "Vous ne possédez pas la clé publique de %{key}!"
|
||||||
genkey_gpg:
|
genkey_gpg:
|
||||||
exception: "La création de la clé GPG n'a pas pu aboutir!"
|
exception: "La création de la clé GPG n'a pas pu aboutir!"
|
||||||
name: "Vous devez définir un nom pour votre clé GPG!"
|
name: "Vous devez définir un nom pour votre clé GPG!"
|
||||||
|
@ -90,6 +91,7 @@ fr:
|
||||||
length: "Taille de la clé GPG [défaut=2048]: "
|
length: "Taille de la clé GPG [défaut=2048]: "
|
||||||
expire: "Expiration de la clé GPG [défaut=0 (illimité)]: "
|
expire: "Expiration de la clé GPG [défaut=0 (illimité)]: "
|
||||||
wait: "Veuillez patienter durant la génération de votre clé GPG, ce processus peut prendre quelques minutes."
|
wait: "Veuillez patienter durant la génération de votre clé GPG, ce processus peut prendre quelques minutes."
|
||||||
|
valid: "Votre clé GPG a bien été créée ;-)"
|
||||||
update:
|
update:
|
||||||
title: "Mis à jour d'un élément"
|
title: "Mis à jour d'un élément"
|
||||||
name: "Entrez le nom [%{name}]: "
|
name: "Entrez le nom [%{name}]: "
|
||||||
|
|
Loading…
Reference in a new issue