Skip to content

Commit

Permalink
KeyPair: also construct the public and private part
Browse files Browse the repository at this point in the history
  • Loading branch information
benallard committed Jan 28, 2013
1 parent 4d11aee commit 6afd2f9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pythoncard/security/keypair.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ def __init__(self, param1, param2):
if isinstance(param1, int):
self._algorithm = param1
self._keylength = param2
self._publicKey = None
self._privateKey = None
if self._algorithm == self.ALG_RSA:
self._publicKey = KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, self._keylength, None)
self._privateKey = KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE, self._keylength, None)
elif self._algorithm == self.ALG_RSA_CRT:
self._publicKey = KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, self._keylength, None)
self._privateKey = KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_CRT_PRIVATE, self._keylength, None)
else:
raise CryptoException(CryptoException.NO_SUCH_ALGORITHM)
else:
if not isinstance(param1, RSAPublicKey):
raise CryptoException(CryptoException.ILLEGAL_VALUE)
Expand Down

0 comments on commit 6afd2f9

Please sign in to comment.