summaryrefslogtreecommitdiffstats
path: root/base/kra/functional
Commit message (Collapse)AuthorAgeFilesLines
* Fix flake8 / PEP 8 violationsChristian Heimes2016-01-251-7/+4
| | | | https://fedorahosted.org/pki/ticket/1738
* Replace legacy Python base64 invocations with Py3-safe codeChristian Heimes2015-10-012-16/+20
| | | | | | | | | Replace deprecated decodestring() and encodestring() with b64decode() and b64encode(). Provice specialized encode_cert() / decode_cert() functions to handle base64 encoding and decoding for X.509 certs in JSON strings. In Python 3 the base64 function don't suppor ASCII text, just ASCII bytes.
* Py3 modernization: misc manual fixesChristian Heimes2015-08-172-3/+3
| | | | | | | | | | | | | | | | | | | | | | Python 3's exception class has no message attribute. e.message can either be replaced with string representation of e or e.args[0]. Use print(line, end='') instead of sys.stdout.write(). With end='' no new line is appended. Use six.reraise() to reraise an exception. Remove sys.exc_clear() as it is no longer available in Python 3. Conditionally import shutil.WindowsError. Use six.move to import correct modules / function like quote, urlparse and configparser. Silence some pylint warnings. pylint doesn't understand six.moves magic and emits a import-error warning. Add additional tox envs to check for Python 3 compatibility.
* Py3 modernization: libmodernize.fixes.fix_dict_sixChristian Heimes2015-08-171-1/+1
| | | | | | | | | In Python 3 dict methods like values(), items() and keys() return views rather than lists. The iter equivalents are gone. Use six to use iterators on Python 2 and 3. In some places like setup.py a list is required. Use list(somedict.values()) to get a list on all Python versions.
* Py3 modernization: libmodernize.fixes.fix_unicode_typeChristian Heimes2015-08-171-17/+18
| | | | | The unicode type has been renamed to str. six.text_type is unicode in Python 2 and str in Python 3.
* Py3 modernization: libmodernize.fixes.fix_xrange_sixChristian Heimes2015-08-171-0/+2
| | | | | In Python 3 range() returns an iterator and xrange() is gone. Use six.moves to use an iterable range() on Python 2.
* Py3 modernization: libmodernize.fixes.fix_printChristian Heimes2015-08-172-89/+91
| | | | | | | | | Replace print statement with Python 3's print() function. For Python 2 'from __future__ import print_function' turns the print statement into Python 3 compatible print function. See https://www.python.org/dev/peps/pep-3105/
* Py3 modernization: libmodernize.fixes.fix_importChristian Heimes2015-08-172-0/+2
| | | | | | | | | | | | | | Enforce absolute imports or explicit relative imports. Python 3 no longer supports implicit relative imports, that is unqualified imports from a module's directory. In order to load a module from the same directory inside a package, use from . import module The future feature 'from __future__ import absolute_import' ensures that pki uses absolute imports on Python 2, too. See https://www.python.org/dev/peps/pep-0328/
* Make pki PEP 8 compatibleChristian Heimes2015-08-142-136/+224
| | | | | | | | | | | | | | | | | | | Large portions of the patch was automatically created with autopep8: find base/ -name '*.py' | xargs autopep8 --in-place --ignore E309 \ --aggressive find base/common/upgrade base/server/upgrade -type f -and \ -not -name .gitignore | autopep8 --in-place --ignore E309 --aggressive autopep8 --in-place --ignore E309 --aggressive \ base/common/sbin/pki-upgrade \ base/server/sbin/pkispawn \ base/server/sbin/pkidestroy \ base/server/sbin/pki-server \ base/server/sbin/pki-server-upgrade About two dozent violations were fixed manually. https://fedorahosted.org/pki/ticket/708
* Updated KRA Python client library.Endi S. Dewata2014-10-092-33/+129
| | | | | | | | | | | | | | | The Python client library for KRA has been modified to simplify the usage. The NSSCryptoProvider's setup_database() and __init__() now take a password file parameter. The import_cert() now can take either cert binary/encoded data or CertData object. It also provides a default value for the trust attribute. The KRAClient now stores the crypto provider object. The KRA test has been updated to provide options to override the default test configuration (e.g. hostname, port). It also has been modified to use a temporary NSS database. The setup document has been updated to describe the process to run the test as root and as a regular user.
* Makes output of secrets consistent for all clients.Abhishek Koneru2014-08-292-10/+5
| | | | | | All the secrets/keys retrieved using the client API's using Java/python clients will be of the type - byte array. This applies to output of the retrieveKey method and the public key attribute of the KeyInfo object.
* Generate asymmetric keys in the DRM.Abhishek Koneru2014-08-272-2/+128
| | | | | | | | | | | | Adds methods to key client to generate asymmetric keys using algorithms RSA and DSA for a valid key sizes of 512, 1024, 2048,4096. The generated keys are archived in the database. Using the CLI, the public key(base64 encoded) can be retrieved by using the key-show command. The private key(base64 encoded) can be retrieved using the key-retrieve command. Ticket #1023
* Added transport cert attributes.Endi S. Dewata2014-07-091-0/+1
| | | | | | | | The REST service has been modified to return additional attributes for transport certificate including serial number, issuer DN, subject DN, and resource link. Ticket #1065
* Refactored SystemCertClient.get_transport_cert().Endi S. Dewata2014-07-071-4/+2
| | | | | | | | | | | | | | | To simplify the usage, the SystemCertClient.get_transport_cert() has been modified to parse and decode the PEM certificate in CertData object, store the DER certificate back into the object, and return the CertData object to the client. This way the client will have access to the certificate attributes and both PEM and DER certificates. The PKIService.sendConditionalGetResponse() has been fixed to use the requested format. This is needed to display the transport certificate properly in the browser. Ticket #1062
* Renamed CryptoUtil to CryptoProvider.Endi S. Dewata2014-07-031-3/+3
| | | | | | | | The CryptoUtil classes in the Python client library has been renamed to CryptoProvider for consistency with the Java client library. The cryptoutil.py module has been renamed to crypto.py. Ticket #1042
* Fixes for #1040 and #1041 in cert and key python modulesAbhishek Koneru2014-06-272-31/+48
| | | | | | | | | | Ticket 1040 - Perform null checks on JSON attributes. Ticket 1041 - Rename module kraclient to kra. Also refactored the code in cert module removing the usage of property. Achieved the conversion of names(camelCase to '_' separated ) using a dictionaries in the objects. The default method in encoder module has also been modified to perform the reverse conversion.
* latest changes for code reviewAde Lee2014-05-291-36/+41
|
* Refactoring KeyClient class and crypto classes.Abhishek Koneru2014-03-312-57/+52
|
* Changes to KeyClient on the java side.Abhishek Koneru2014-03-192-229/+138
| | | | | The KeyClient class on the java side is modified to have a similar design as the KeyClient class on the python side.
* Minor fix to a comment added in the previous patch.Abhishek Koneru2014-03-061-3/+2
|
* Modify return object for retrieve_key(key_id, twsk)Abhishek Koneru2014-03-061-8/+14
| | | | | | | Modify the return type of the function retrieve_key(key_id, trans_wrapped_session_key) from returining a tuple KeyData, unwrapped_key to KeyData by setting the unwrapped_key to KeyData.private_data attribute for the case where trans_wrapped_session_key is not provided by the caller.
* Get archival working for python key clientAde Lee2014-03-051-6/+18
|
* Fixes for coments from reviewAde Lee2014-02-262-14/+13
|
* Add ability to archive without sending pkiArchiveOptions object.Ade Lee2014-02-262-7/+20
| | | | | | With this patch, you can now either send a pkiArchiveOptions object or the exploded parameters. This reduces the processing required on the client side.
* Make generate_symmetric_key more generic.Ade Lee2014-02-261-1/+1
| | | | | | Added a method generate_session_key() which should be used when wrapping secrets for the drm. For now, this has to be a 168-bit 3DES symmetric key.
* Added error checking in python client callsAde Lee2014-02-261-9/+17
| | | | | | | | | 1) Added error checking in python client calls. 2) Allow symmetric key generation with default params. Fix bug for when usages is not defined. 3) Fix bug when requesting key recovery - must check if key exists. 4) Extend key gen to allow for providing trans_wrapped_session_key 5) added constants to python client for key status
* Moved key functions out of kraclient.pyAde Lee2014-02-261-22/+33
|
* reame client_id to client_key_idAde Lee2014-02-262-25/+26
|
* Add getActiveKey() to the python clientAde Lee2014-02-261-1/+14
|
* Add methods to create nss certdb and import certAde Lee2014-02-261-5/+15
| | | | | Also changed arguments so that all args and returns from CryptoUtil are unencoded.
* Add methods to getKeyInfo and change key statusAde Lee2014-02-192-5/+42
|
* Updated REST interface for keys.Endi S. Dewata2014-02-191-45/+48
| | | | | | | | | The REST interface for keys has been modified to return Response objects to allow better handling of server responses. Key-related methods in KRAClient have been moved into KeyClient. The DRMTest has been updated accordingly. Ticket #554
* Added REST client for system certificates.Endi S. Dewata2014-02-191-2/+5
| | | | | | A new REST client has been added to access system certificates. Ticket #554
* Added decorator to handle exceptionsAde Lee2014-02-191-0/+26
| | | | | | Decorator catches HttpErrorExceptions from Requests and extracts the relevant PKIException object, and rethrows it.
* Additional changes as per review.Ade Lee2014-02-194-5/+166
| | | | | | | | | | 1. Moved most methods back into the key.py module. 2. Simplified the invocation by combining the KeyClient and KeyRequestClient as just KeyClient. 3. Added additional invocations in KRAClient - with lots of docuemntation. These are hopefully more user friendly. 4. Extracted crypto operations to cryptoutil class. This class has an NSS implementation provided. 5. Addressed other issues found in review.
* Initial work on python APIAde Lee2014-02-191-10/+10
| | | | | | | | This patch includes code for most of the python client library for the KeyResource and KeyRequestResource for the DRM. Some place holder code has been added for the CertResource, but this needs to be further refined and tested.
* Fix minor issues from review.Ade Lee2014-02-101-1/+1
| | | | | | 1. Use size/keySize consistently, instead of strength. 2. Change to using Integer instead of int in SymKeyGenerationRequest. 3. Fix error message.
* Change the return type for KeyRequest creation operationsAde Lee2014-02-101-31/+34
| | | | | | We will likely want to extend the REST API to allow the immediate return of a generated key, and perhaps of a recovered key in a single step. This change allows us to do that.
* Add strength and algorithm to KeyData and KeyInfo classesAde Lee2014-02-101-1/+12
| | | | | | Make sure these are updated so that clients can get this information when accessing a symmetric key. Also allow a default for generation requests (but not for archival requests).
* Fix DRM archival, recovery and generation for non-DES3 keys.Ade Lee2014-02-041-7/+87
| | | | | | | | | | | In the archival, recovery and generation code for symmetric keys, we use functions that require knowledge of the symmetric keys algorithm and key size. These were hardcoded to DES3, and so only DES3 worked. We added those parameters to the archival request, save them in the KeyRecord and retrive them when recovering the key. Tests have been added to DRMTest for the relevant usages.
* Address review commentsAde Lee2014-02-041-3/+3
| | | | | | | | | 1. Remove Link attribute from ResourceMessage, 2. Rename KeyDataInfo and KeyDataInfoCollection. 3. Move KEYGEN_ALGORITHMS 4. Fix missing space in PKIException 5. Move properties to attributes in ResourceMessage 6. Add missing code to update the request and set IRequest.RESULT
* Rename KeyRequest to ResourceMessageAde Lee2014-02-041-15/+37
| | | | | | Refactor ResourceMessage to include classname instead of Request Type. Also changed PKIException.Data to extend ResourceMessage. Modifications to the server code to get the tests working.
* Added more client code for DRM testsAde Lee2014-02-041-1/+81
|
* REST interface extensionAndrew Wnuk2013-11-181-0/+38
| | | | | | This patch provides REST interface extension allowing recovery of asymmetric keys. Ticket #439.
* Refactored client framework.Endi S. Dewata2013-08-231-3/+4
| | | | | | | | | A new Client class was added as a base for all client classes. The SubsystemClient was added as a base for all subsystem clients. It also provides methods to authenticate against the subsystem. The DRMClient has been renamed to KRAClient to match the actual subsystem name. Ticket #701
* Applied PEP8 formatting to python files.Abhishek Koneru2013-06-271-174/+174
| | | | | | | General formatting done for all the python files except for the line length issue, which could not be formatted using Pydev in Eclipse. Ticket #316
* Use 'with' construct for file operations.Abhishek Koneru2013-06-061-6/+10
| | | | | | | | Replace try-except with with construct in python code in applicable places where there is no exception handling required. Also added finally block to close resources opened in a try except block. Ticket #560
* Fixed KRA test.Endi Sukma Dewata2012-10-221-7/+7
| | | | | The security configuration, JAXB mappings, and test script for KRA have been updated to run properly.
* Moved REST CLI into pki-tools.Endi Sukma Dewata2012-08-291-2/+2
| | | | | | | | | | The pki-client.jar has been split and merged into pki-certsrv.jar and pki-tools.jar. The REST client classes are now packaged in com.netscape.certsrv.<component> packages. The REST CLI classes are now packaged in com.netscape.cmstools.<component> packages. The "pki" script has been moved into pki-tools RPM package. Ticket #215
* Reorganized REST common classes.Endi Sukma Dewata2012-08-151-5/+5
| | | | | | | The common classes used by REST client and services have been moved into the com.netscape.certsrv.<component> packages. Ticket #215