[Pki-devel] [PATCH] 513 Renamed CryptoUtil to CryptoProvider.
Fraser Tweedale
ftweedal at redhat.com
Wed Jul 2 05:57:32 UTC 2014
On Tue, Jul 01, 2014 at 07:52:31PM -0500, Endi Sukma Dewata wrote:
> 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
>
> The drmtest.py works fine with these changes.
>
> --
> Endi S. Dewata
Haven't run drmtest myself but it doesn't look like you've missed
anything and changes apply and build fine.
ACK
> From 96a662d1884f3898bc5d119166854b9e4e12997b Mon Sep 17 00:00:00 2001
> From: "Endi S. Dewata" <edewata at redhat.com>
> Date: Tue, 1 Jul 2014 15:36:03 -0400
> Subject: [PATCH] Renamed CryptoUtil to CryptoProvider.
>
> 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
> ---
> base/common/python/pki/{cryptoutil.py => crypto.py} | 8 ++++----
> base/common/python/pki/key.py | 4 ++--
> base/common/python/pki/kra.py | 6 +++---
> base/kra/functional/drmtest.py | 6 +++---
> 4 files changed, 12 insertions(+), 12 deletions(-)
> rename base/common/python/pki/{cryptoutil.py => crypto.py} (98%)
>
> diff --git a/base/common/python/pki/cryptoutil.py b/base/common/python/pki/crypto.py
> similarity index 98%
> rename from base/common/python/pki/cryptoutil.py
> rename to base/common/python/pki/crypto.py
> index 44adb3fb6f377053e85b26be1f3a9652ba1c8ef3..174e681b8fedf37973ec4d15cf0aca1e12a774ec 100644
> --- a/base/common/python/pki/cryptoutil.py
> +++ b/base/common/python/pki/crypto.py
> @@ -30,7 +30,7 @@ import subprocess
> import tempfile
>
>
> -class CryptoUtil(object):
> +class CryptoProvider(object):
> """
> Abstract class containing methods to do cryptographic operations.
> """
> @@ -93,9 +93,9 @@ class CryptoUtil(object):
> pass
>
>
> -class NSSCryptoUtil(CryptoUtil):
> +class NSSCryptoProvider(CryptoProvider):
> """
> - Class that defines NSS implementation of CryptoUtil.
> + Class that defines NSS implementation of CryptoProvider.
> Requires an NSS database to have been set up and initialized.
>
> Note that all inputs and outputs are unencoded.
> @@ -126,7 +126,7 @@ class NSSCryptoUtil(CryptoUtil):
> This method expects a NSS database to have already been created at
> certdb_dir with password certdb_password.
> """
> - CryptoUtil.__init__(self)
> + CryptoProvider.__init__(self)
> self.certdb_dir = certdb_dir
> self.certdb_password = certdb_password
> self.nonce_iv = "e4:bb:3b:d3:c3:71:2e:58"
> diff --git a/base/common/python/pki/key.py b/base/common/python/pki/key.py
> index 048cc0d41a500513cf4c0f7860dcb8756fa6d714..af34a7ff42ffe288f9b1f2767989bfc2b383343d 100644
> --- a/base/common/python/pki/key.py
> +++ b/base/common/python/pki/key.py
> @@ -770,7 +770,7 @@ class KeyClient(object):
>
> 1) trans_wrapped_session_key is not provided by caller.
>
> - In this case, the function will call CryptoUtil methods to generate and
> + In this case, the function will call CryptoProvider methods to generate and
> wrap the session key. The function will return the KeyData object with
> a private_data attribute which stores the unwrapped key information.
>
> @@ -833,7 +833,7 @@ class KeyClient(object):
>
> 1) A passphrase is provided by the caller.
>
> - In this case, CryptoUtil methods will be called to create the data to
> + In this case, CryptoProvider methods will be called to create the data to
> securely send the passphrase to the DRM. Basically, three pieces of
> data will be sent:
>
> diff --git a/base/common/python/pki/kra.py b/base/common/python/pki/kra.py
> index e3daabdd350383e6bd178779f8c0ea71aa0fe682..6559b986b05bc3e9049cdf7d95a8bef19a118cd8 100644
> --- a/base/common/python/pki/kra.py
> +++ b/base/common/python/pki/kra.py
> @@ -40,13 +40,13 @@ class KRAClient(object):
> """ Constructor
>
> :param connection - PKIConnection object with DRM connection info.
> - :param crypto - CryptoUtil object. NSSCryptoUtil is provided by
> + :param crypto - CryptoProvider object. NSSCryptoProvider is provided by
> default. If a different crypto implementation is
> - desired, a different subclass of CryptoUtil must be
> + desired, a different subclass of CryptoProvider must be
> provided.
> :param transport_cert_nick - identifier for the DRM transport
> certificate. This will be passed to the
> - CryptoUtil.get_cert() command to get a representation
> + CryptoProvider.get_cert() command to get a representation
> of the transport certificate usable for crypto ops.
> Note that for NSS databases, the database must have been
> initialized beforehand.
> diff --git a/base/kra/functional/drmtest.py b/base/kra/functional/drmtest.py
> index 9ef096194793a37f7ed3290d43e58a366522f718..abade351112c73e9c075631440dcae6797567971 100644
> --- a/base/kra/functional/drmtest.py
> +++ b/base/kra/functional/drmtest.py
> @@ -33,7 +33,7 @@ See drmtest.readme.txt.
>
> import base64
> import pki
> -import pki.cryptoutil as cryptoutil
> +import pki.crypto
> import pki.key as key
> import time
>
> @@ -80,11 +80,11 @@ def main():
> # create an NSS DB for crypto operations
> certdb_dir = "/tmp/drmtest-certdb"
> certdb_password = "redhat123"
> - cryptoutil.NSSCryptoUtil.setup_database(certdb_dir, certdb_password,
> + pki.crypto.NSSCryptoProvider.setup_database(certdb_dir, certdb_password,
> over_write=True)
>
> #create kraclient
> - crypto = cryptoutil.NSSCryptoUtil(certdb_dir, certdb_password)
> + crypto = pki.crypto.NSSCryptoProvider(certdb_dir, certdb_password)
> kraclient = KRAClient(connection, crypto)
> keyclient = kraclient.keys
>
> --
> 1.8.4.2
>
> _______________________________________________
> Pki-devel mailing list
> Pki-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/pki-devel
More information about the Pki-devel
mailing list