1
0

importprivkey: do not import the same key twice

This commit is contained in:
ThomasV
2016-08-17 09:49:58 +02:00
parent 2e9cfb9800
commit 5733a5d125
3 changed files with 5 additions and 4 deletions

View File

@@ -115,7 +115,9 @@ class Imported_KeyStore(Software_KeyStore):
try:
pubkey = public_key_from_private_key(sec)
except Exception:
raise Exception('Invalid private key')
raise BaseException('Invalid private key')
if pubkey in self.keypairs:
raise BaseException('Private key already in keystore')
self.keypairs[pubkey] = sec
return pubkey