Hello community, here is the log from the commit of package python-rsa for openSUSE:Factory checked in at 2013-10-13 12:16:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-rsa (Old) and /work/SRC/openSUSE:Factory/.python-rsa.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-rsa" Changes: -------- --- /work/SRC/openSUSE:Factory/python-rsa/python-rsa.changes 2013-08-13 10:59:51.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-rsa.new/python-rsa.changes 2013-10-13 12:16:49.000000000 +0200 @@ -1,0 +2,9 @@ +Fri Oct 11 23:06:55 UTC 2013 - [email protected] + +- Update to version 3.1.2 + + No changelog available +- Replace python-distribute with python-setuptools BuildRequires +- Remove rsa-use-system-setuptools.patch; merged upstream +- Implement update-alternatives + +------------------------------------------------------------------- Old: ---- rsa-3.1.1.tar.gz rsa-use-system-setuptools.patch New: ---- rsa-3.1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-rsa.spec ++++++ --- /var/tmp/diff_new_pack.b4zXe4/_old 2013-10-13 12:16:50.000000000 +0200 +++ /var/tmp/diff_new_pack.b4zXe4/_new 2013-10-13 12:16:50.000000000 +0200 @@ -17,19 +17,20 @@ Name: python-rsa -Version: 3.1.1 +Version: 3.1.2 Release: 0 Url: http://stuvel.eu/rsa Summary: Pure-Python RSA Implementation License: Apache-2.0 Group: Development/Languages/Python Source: http://pypi.python.org/packages/source/r/rsa/rsa-%{version}.tar.gz -Patch0: rsa-use-system-setuptools.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python-devel -BuildRequires: python-distribute +BuildRequires: python-setuptools BuildRequires: python-pyasn1 Requires: python-pyasn1 +Requires(post): update-alternatives +Requires(postun): update-alternatives %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %else @@ -43,21 +44,80 @@ %prep %setup -q -n rsa-%{version} -%patch0 -p1 +sed -i "s/pyrsa-priv2pub/pyrsa-priv2pub-%{py_ver}/" setup.py +sed -i "s/pyrsa-keygen/pyrsa-keygen-%{py_ver}/" setup.py +sed -i "s/pyrsa-encrypt =/pyrsa-encrypt-%{py_ver} =/" setup.py +sed -i "s/pyrsa-decrypt =/pyrsa-decrypt-%{py_ver} =/" setup.py +sed -i "s/pyrsa-sign/pyrsa-sign-%{py_ver}/" setup.py +sed -i "s/pyrsa-verify/pyrsa-verify-%{py_ver}/" setup.py +sed -i "s/pyrsa-encrypt-bigfile =/pyrsa-encrypt-bigfile-%{py_ver} =/" setup.py +sed -i "s/pyrsa-decrypt-bigfile =/pyrsa-decrypt-bigfile-%{py_ver} =/" setup.py %build python setup.py build %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} +ln -s %{_bindir}/pyrsa-priv2pub-%{py_ver} %{buildroot}%{_bindir}/pyrsa-priv2pub +ln -s %{_bindir}/pyrsa-keygen-%{py_ver} %{buildroot}%{_bindir}/pyrsa-keygen +ln -s %{_bindir}/pyrsa-encrypt-%{py_ver} %{buildroot}%{_bindir}/pyrsa-encrypt +ln -s %{_bindir}/pyrsa-decrypt-%{py_ver} %{buildroot}%{_bindir}/pyrsa-decrypt +ln -s %{_bindir}/pyrsa-sign-%{py_ver} %{buildroot}%{_bindir}/pyrsa-sign +ln -s %{_bindir}/pyrsa-verify-%{py_ver} %{buildroot}%{_bindir}/pyrsa-verify +ln -s %{_bindir}/pyrsa-encrypt-bigfile-%{py_ver} %{buildroot}%{_bindir}/pyrsa-encrypt-bigfile +ln -s %{_bindir}/pyrsa-decrypt-bigfile-%{py_ver} %{buildroot}%{_bindir}/pyrsa-decrypt-bigfile %check python setup.py test +%pre +# Since binaries became ghosted to be used with update-alternatives, we have to get rid +# of the old binary resulting from the non-update-alternativies-ified package: +[[ ! -L %{_bindir}/pyrsa-priv2pub ]] && rm -f %{_bindir}/pyrsa-priv2pub +[[ ! -L %{_bindir}/pyrsa-keygen ]] && rm -f %{_bindir}/pyrsa-keygen +[[ ! -L %{_bindir}/pyrsa-encrypt ]] && rm -f %{_bindir}/pyrsa-encrypt +[[ ! -L %{_bindir}/pyrsa-decrypt ]] && rm -f %{_bindir}/pyrsa-decrypt +[[ ! -L %{_bindir}/pyrsa-sign ]] && rm -f %{_bindir}/pyrsa-sign +[[ ! -L %{_bindir}/pyrsa-verify ]] && rm -f %{_bindir}/pyrsa-verify +[[ ! -L %{_bindir}/pyrsa-encrypt-bigfile ]] && rm -f %{_bindir}/pyrsa-encrypt-bigfile +[[ ! -L %{_bindir}/pyrsa-decrypt-bigfile ]] && rm -f %{_bindir}/pyrsa-decrypt-bigfile +exit 0 + +%post +update-alternatives \ + --install %{_bindir}/pyrsa-priv2pub pyrsa-priv2pub %{_bindir}/pyrsa-priv2pub-%{py_ver} 30 \ + --slave %{_bindir}/pyrsa-keygen pyrsa-keygen %{_bindir}/pyrsa-keygen-%{py_ver} \ + --slave %{_bindir}/pyrsa-encrypt pyrsa-encrypt %{_bindir}/pyrsa-encrypt-%{py_ver} \ + --slave %{_bindir}/pyrsa-decrypt pyrsa-decrypt %{_bindir}/pyrsa-decrypt-%{py_ver} \ + --slave %{_bindir}/pyrsa-sign pyrsa-sign %{_bindir}/pyrsa-sign-%{py_ver} \ + --slave %{_bindir}/pyrsa-verify pyrsa-verify %{_bindir}/pyrsa-verify-%{py_ver} \ + --slave %{_bindir}/pyrsa-encrypt-bigfile pyrsa-encrypt-bigfile %{_bindir}/pyrsa-encrypt-bigfile-%{py_ver} \ + --slave %{_bindir}/pyrsa-decrypt-bigfile pyrsa-decrypt-bigfile %{_bindir}/pyrsa-decrypt-bigfile-%{py_ver} \ + +%preun +if [ $1 -eq 0 ] ; then + update-alternatives --remove pyrsa-priv2pub %{_bindir}/pyrsa-priv2pub-%{py_ver} +fi + %files %defattr(-,root,root,-) %doc LICENSE -%{_bindir}/pyrsa-* +%ghost %{_bindir}/pyrsa-priv2pub +%{_bindir}/pyrsa-priv2pub-%{py_ver} +%ghost %{_bindir}/pyrsa-keygen +%{_bindir}/pyrsa-keygen-%{py_ver} +%ghost %{_bindir}/pyrsa-encrypt +%{_bindir}/pyrsa-encrypt-%{py_ver} +%ghost %{_bindir}/pyrsa-decrypt +%{_bindir}/pyrsa-decrypt-%{py_ver} +%ghost %{_bindir}/pyrsa-sign +%{_bindir}/pyrsa-sign-%{py_ver} +%ghost %{_bindir}/pyrsa-verify +%{_bindir}/pyrsa-verify-%{py_ver} +%ghost %{_bindir}/pyrsa-encrypt-bigfile +%{_bindir}/pyrsa-encrypt-bigfile-%{py_ver} +%ghost %{_bindir}/pyrsa-decrypt-bigfile +%{_bindir}/pyrsa-decrypt-bigfile-%{py_ver} %{python_sitelib}/* %changelog ++++++ rsa-3.1.1.tar.gz -> rsa-3.1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/PKG-INFO new/rsa-3.1.2/PKG-INFO --- old/rsa-3.1.1/PKG-INFO 2012-06-18 17:17:03.000000000 +0200 +++ new/rsa-3.1.2/PKG-INFO 2013-09-15 13:04:27.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: rsa -Version: 3.1.1 +Version: 3.1.2 Summary: Pure-Python RSA implementation Home-page: http://stuvel.eu/rsa Author: Sybren A. Stuvel @@ -15,4 +15,9 @@ Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.2 +Classifier: Programming Language :: Python :: 3.3 Classifier: Topic :: Security :: Cryptography diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/README.rst new/rsa-3.1.2/README.rst --- old/rsa-3.1.1/README.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/rsa-3.1.2/README.rst 2013-09-15 12:30:48.000000000 +0200 @@ -0,0 +1,31 @@ +Pure Python RSA implementation +============================== + +`Python-RSA`_ is a pure-Python RSA implementation. It supports +encryption and decryption, signing and verifying signatures, and key +generation according to PKCS#1 version 1.5. It can be used as a Python +library as well as on the commandline. The code was mostly written by +Sybren A. Stüvel. + +Documentation can be found at the Python-RSA homepage: +http://stuvel.eu/rsa + +Download and install using:: + + pip install rsa + +or:: + + easy_install rsa + +or download it from the `Python Package Index`_. + +The source code is maintained in a `Mercurial repository`_ and is +licensed under the `Apache License, version 2.0`_ + + +.. _`Python-RSA`: http://stuvel.eu/rsa +.. _`Mercurial repository`: https://bitbucket.org/sybren/python-rsa +.. _`Python Package Index`: http://pypi.python.org/pypi/rsa +.. _`Apache License, version 2.0`: http://www.apache.org/licenses/LICENSE-2.0 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/distribute_setup.py new/rsa-3.1.2/distribute_setup.py --- old/rsa-3.1.1/distribute_setup.py 2012-01-29 11:42:03.000000000 +0100 +++ new/rsa-3.1.2/distribute_setup.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,485 +0,0 @@ -#!python -"""Bootstrap distribute installation - -If you want to use setuptools in your package's setup.py, just include this -file in the same directory with it, and add this to the top of your setup.py:: - - from distribute_setup import use_setuptools - use_setuptools() - -If you want to require a specific version of setuptools, set a download -mirror, or use an alternate download directory, you can do so by supplying -the appropriate options to ``use_setuptools()``. - -This file can also be run as a script to install or upgrade setuptools. -""" -import os -import sys -import time -import fnmatch -import tempfile -import tarfile -from distutils import log - -try: - from site import USER_SITE -except ImportError: - USER_SITE = None - -try: - import subprocess - - def _python_cmd(*args): - args = (sys.executable,) + args - return subprocess.call(args) == 0 - -except ImportError: - # will be used for python 2.3 - def _python_cmd(*args): - args = (sys.executable,) + args - # quoting arguments if windows - if sys.platform == 'win32': - def quote(arg): - if ' ' in arg: - return '"%s"' % arg - return arg - args = [quote(arg) for arg in args] - return os.spawnl(os.P_WAIT, sys.executable, *args) == 0 - -DEFAULT_VERSION = "0.6.24" -DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/" -SETUPTOOLS_FAKED_VERSION = "0.6c11" - -SETUPTOOLS_PKG_INFO = """\ -Metadata-Version: 1.0 -Name: setuptools -Version: %s -Summary: xxxx -Home-page: xxx -Author: xxx -Author-email: xxx -License: xxx -Description: xxx -""" % SETUPTOOLS_FAKED_VERSION - - -def _install(tarball): - # extracting the tarball - tmpdir = tempfile.mkdtemp() - log.warn('Extracting in %s', tmpdir) - old_wd = os.getcwd() - try: - os.chdir(tmpdir) - tar = tarfile.open(tarball) - _extractall(tar) - tar.close() - - # going in the directory - subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) - os.chdir(subdir) - log.warn('Now working in %s', subdir) - - # installing - log.warn('Installing Distribute') - if not _python_cmd('setup.py', 'install'): - log.warn('Something went wrong during the installation.') - log.warn('See the error message above.') - finally: - os.chdir(old_wd) - - -def _build_egg(egg, tarball, to_dir): - # extracting the tarball - tmpdir = tempfile.mkdtemp() - log.warn('Extracting in %s', tmpdir) - old_wd = os.getcwd() - try: - os.chdir(tmpdir) - tar = tarfile.open(tarball) - _extractall(tar) - tar.close() - - # going in the directory - subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) - os.chdir(subdir) - log.warn('Now working in %s', subdir) - - # building an egg - log.warn('Building a Distribute egg in %s', to_dir) - _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir) - - finally: - os.chdir(old_wd) - # returning the result - log.warn(egg) - if not os.path.exists(egg): - raise IOError('Could not build the egg.') - - -def _do_download(version, download_base, to_dir, download_delay): - egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg' - % (version, sys.version_info[0], sys.version_info[1])) - if not os.path.exists(egg): - tarball = download_setuptools(version, download_base, - to_dir, download_delay) - _build_egg(egg, tarball, to_dir) - sys.path.insert(0, egg) - import setuptools - setuptools.bootstrap_install_from = egg - - -def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, - to_dir=os.curdir, download_delay=15, no_fake=True): - # making sure we use the absolute path - to_dir = os.path.abspath(to_dir) - was_imported = 'pkg_resources' in sys.modules or \ - 'setuptools' in sys.modules - try: - try: - import pkg_resources - if not hasattr(pkg_resources, '_distribute'): - if not no_fake: - _fake_setuptools() - raise ImportError - except ImportError: - return _do_download(version, download_base, to_dir, download_delay) - try: - pkg_resources.require("distribute>="+version) - return - except pkg_resources.VersionConflict: - e = sys.exc_info()[1] - if was_imported: - sys.stderr.write( - "The required version of distribute (>=%s) is not available,\n" - "and can't be installed while this script is running. Please\n" - "install a more recent version first, using\n" - "'easy_install -U distribute'." - "\n\n(Currently using %r)\n" % (version, e.args[0])) - sys.exit(2) - else: - del pkg_resources, sys.modules['pkg_resources'] # reload ok - return _do_download(version, download_base, to_dir, - download_delay) - except pkg_resources.DistributionNotFound: - return _do_download(version, download_base, to_dir, - download_delay) - finally: - if not no_fake: - _create_fake_setuptools_pkg_info(to_dir) - -def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, - to_dir=os.curdir, delay=15): - """Download distribute from a specified location and return its filename - - `version` should be a valid distribute version number that is available - as an egg for download under the `download_base` URL (which should end - with a '/'). `to_dir` is the directory where the egg will be downloaded. - `delay` is the number of seconds to pause before an actual download - attempt. - """ - # making sure we use the absolute path - to_dir = os.path.abspath(to_dir) - try: - from urllib.request import urlopen - except ImportError: - from urllib2 import urlopen - tgz_name = "distribute-%s.tar.gz" % version - url = download_base + tgz_name - saveto = os.path.join(to_dir, tgz_name) - src = dst = None - if not os.path.exists(saveto): # Avoid repeated downloads - try: - log.warn("Downloading %s", url) - src = urlopen(url) - # Read/write all in one block, so we don't create a corrupt file - # if the download is interrupted. - data = src.read() - dst = open(saveto, "wb") - dst.write(data) - finally: - if src: - src.close() - if dst: - dst.close() - return os.path.realpath(saveto) - -def _no_sandbox(function): - def __no_sandbox(*args, **kw): - try: - from setuptools.sandbox import DirectorySandbox - if not hasattr(DirectorySandbox, '_old'): - def violation(*args): - pass - DirectorySandbox._old = DirectorySandbox._violation - DirectorySandbox._violation = violation - patched = True - else: - patched = False - except ImportError: - patched = False - - try: - return function(*args, **kw) - finally: - if patched: - DirectorySandbox._violation = DirectorySandbox._old - del DirectorySandbox._old - - return __no_sandbox - -def _patch_file(path, content): - """Will backup the file then patch it""" - existing_content = open(path).read() - if existing_content == content: - # already patched - log.warn('Already patched.') - return False - log.warn('Patching...') - _rename_path(path) - f = open(path, 'w') - try: - f.write(content) - finally: - f.close() - return True - -_patch_file = _no_sandbox(_patch_file) - -def _same_content(path, content): - return open(path).read() == content - -def _rename_path(path): - new_name = path + '.OLD.%s' % time.time() - log.warn('Renaming %s into %s', path, new_name) - os.rename(path, new_name) - return new_name - -def _remove_flat_installation(placeholder): - if not os.path.isdir(placeholder): - log.warn('Unkown installation at %s', placeholder) - return False - found = False - for file in os.listdir(placeholder): - if fnmatch.fnmatch(file, 'setuptools*.egg-info'): - found = True - break - if not found: - log.warn('Could not locate setuptools*.egg-info') - return - - log.warn('Removing elements out of the way...') - pkg_info = os.path.join(placeholder, file) - if os.path.isdir(pkg_info): - patched = _patch_egg_dir(pkg_info) - else: - patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO) - - if not patched: - log.warn('%s already patched.', pkg_info) - return False - # now let's move the files out of the way - for element in ('setuptools', 'pkg_resources.py', 'site.py'): - element = os.path.join(placeholder, element) - if os.path.exists(element): - _rename_path(element) - else: - log.warn('Could not find the %s element of the ' - 'Setuptools distribution', element) - return True - -_remove_flat_installation = _no_sandbox(_remove_flat_installation) - -def _after_install(dist): - log.warn('After install bootstrap.') - placeholder = dist.get_command_obj('install').install_purelib - _create_fake_setuptools_pkg_info(placeholder) - -def _create_fake_setuptools_pkg_info(placeholder): - if not placeholder or not os.path.exists(placeholder): - log.warn('Could not find the install location') - return - pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1]) - setuptools_file = 'setuptools-%s-py%s.egg-info' % \ - (SETUPTOOLS_FAKED_VERSION, pyver) - pkg_info = os.path.join(placeholder, setuptools_file) - if os.path.exists(pkg_info): - log.warn('%s already exists', pkg_info) - return - - log.warn('Creating %s', pkg_info) - f = open(pkg_info, 'w') - try: - f.write(SETUPTOOLS_PKG_INFO) - finally: - f.close() - - pth_file = os.path.join(placeholder, 'setuptools.pth') - log.warn('Creating %s', pth_file) - f = open(pth_file, 'w') - try: - f.write(os.path.join(os.curdir, setuptools_file)) - finally: - f.close() - -_create_fake_setuptools_pkg_info = _no_sandbox(_create_fake_setuptools_pkg_info) - -def _patch_egg_dir(path): - # let's check if it's already patched - pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') - if os.path.exists(pkg_info): - if _same_content(pkg_info, SETUPTOOLS_PKG_INFO): - log.warn('%s already patched.', pkg_info) - return False - _rename_path(path) - os.mkdir(path) - os.mkdir(os.path.join(path, 'EGG-INFO')) - pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') - f = open(pkg_info, 'w') - try: - f.write(SETUPTOOLS_PKG_INFO) - finally: - f.close() - return True - -_patch_egg_dir = _no_sandbox(_patch_egg_dir) - -def _before_install(): - log.warn('Before install bootstrap.') - _fake_setuptools() - - -def _under_prefix(location): - if 'install' not in sys.argv: - return True - args = sys.argv[sys.argv.index('install')+1:] - for index, arg in enumerate(args): - for option in ('--root', '--prefix'): - if arg.startswith('%s=' % option): - top_dir = arg.split('root=')[-1] - return location.startswith(top_dir) - elif arg == option: - if len(args) > index: - top_dir = args[index+1] - return location.startswith(top_dir) - if arg == '--user' and USER_SITE is not None: - return location.startswith(USER_SITE) - return True - - -def _fake_setuptools(): - log.warn('Scanning installed packages') - try: - import pkg_resources - except ImportError: - # we're cool - log.warn('Setuptools or Distribute does not seem to be installed.') - return - ws = pkg_resources.working_set - try: - setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools', - replacement=False)) - except TypeError: - # old distribute API - setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools')) - - if setuptools_dist is None: - log.warn('No setuptools distribution found') - return - # detecting if it was already faked - setuptools_location = setuptools_dist.location - log.warn('Setuptools installation detected at %s', setuptools_location) - - # if --root or --preix was provided, and if - # setuptools is not located in them, we don't patch it - if not _under_prefix(setuptools_location): - log.warn('Not patching, --root or --prefix is installing Distribute' - ' in another location') - return - - # let's see if its an egg - if not setuptools_location.endswith('.egg'): - log.warn('Non-egg installation') - res = _remove_flat_installation(setuptools_location) - if not res: - return - else: - log.warn('Egg installation') - pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO') - if (os.path.exists(pkg_info) and - _same_content(pkg_info, SETUPTOOLS_PKG_INFO)): - log.warn('Already patched.') - return - log.warn('Patching...') - # let's create a fake egg replacing setuptools one - res = _patch_egg_dir(setuptools_location) - if not res: - return - log.warn('Patched done.') - _relaunch() - - -def _relaunch(): - log.warn('Relaunching...') - # we have to relaunch the process - # pip marker to avoid a relaunch bug - if sys.argv[:3] == ['-c', 'install', '--single-version-externally-managed']: - sys.argv[0] = 'setup.py' - args = [sys.executable] + sys.argv - sys.exit(subprocess.call(args)) - - -def _extractall(self, path=".", members=None): - """Extract all members from the archive to the current working - directory and set owner, modification time and permissions on - directories afterwards. `path' specifies a different directory - to extract to. `members' is optional and must be a subset of the - list returned by getmembers(). - """ - import copy - import operator - from tarfile import ExtractError - directories = [] - - if members is None: - members = self - - for tarinfo in members: - if tarinfo.isdir(): - # Extract directories with a safe mode. - directories.append(tarinfo) - tarinfo = copy.copy(tarinfo) - tarinfo.mode = 448 # decimal for oct 0700 - self.extract(tarinfo, path) - - # Reverse sort directories. - if sys.version_info < (2, 4): - def sorter(dir1, dir2): - return cmp(dir1.name, dir2.name) - directories.sort(sorter) - directories.reverse() - else: - directories.sort(key=operator.attrgetter('name'), reverse=True) - - # Set correct owner, mtime and filemode on directories. - for tarinfo in directories: - dirpath = os.path.join(path, tarinfo.name) - try: - self.chown(tarinfo, dirpath) - self.utime(tarinfo, dirpath) - self.chmod(tarinfo, dirpath) - except ExtractError: - e = sys.exc_info()[1] - if self.errorlevel > 1: - raise - else: - self._dbg(1, "tarfile: %s" % e) - - -def main(argv, version=DEFAULT_VERSION): - """Install or upgrade setuptools and EasyInstall""" - tarball = download_setuptools() - _install(tarball) - - -if __name__ == '__main__': - main(sys.argv[1:]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/rsa/__init__.py new/rsa-3.1.2/rsa/__init__.py --- old/rsa-3.1.1/rsa/__init__.py 2012-06-18 15:43:15.000000000 +0200 +++ new/rsa-3.1.2/rsa/__init__.py 2013-09-15 12:30:48.000000000 +0200 @@ -28,8 +28,8 @@ """ __author__ = "Sybren Stuvel, Barry Mead and Yesudeep Mangalapilly" -__date__ = "2012-06-17" -__version__ = '3.1.1' +__date__ = "2013-09-15" +__version__ = '3.1.2' from rsa.key import newkeys, PrivateKey, PublicKey from rsa.pkcs1 import encrypt, decrypt, sign, verify, DecryptionError, \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/rsa/asn1.py new/rsa-3.1.2/rsa/asn1.py --- old/rsa-3.1.1/rsa/asn1.py 1970-01-01 01:00:00.000000000 +0100 +++ new/rsa-3.1.2/rsa/asn1.py 2013-09-15 12:30:48.000000000 +0200 @@ -0,0 +1,35 @@ +'''ASN.1 definitions. + +Not all ASN.1-handling code use these definitions, but when it does, they should be here. +''' + +from pyasn1.type import univ, namedtype, tag + +class PubKeyHeader(univ.Sequence): + componentType = namedtype.NamedTypes( + namedtype.NamedType('oid', univ.ObjectIdentifier()), + namedtype.NamedType('parameters', univ.Null()), + ) + +class OpenSSLPubKey(univ.Sequence): + componentType = namedtype.NamedTypes( + namedtype.NamedType('header', PubKeyHeader()), + + # This little hack (the implicit tag) allows us to get a Bit String as Octet String + namedtype.NamedType('key', univ.OctetString().subtype( + implicitTag=tag.Tag(tagClass=0, tagFormat=0, tagId=3))), + ) + + +class AsnPubKey(univ.Sequence): + '''ASN.1 contents of DER encoded public key: + + RSAPublicKey ::= SEQUENCE { + modulus INTEGER, -- n + publicExponent INTEGER, -- e + ''' + + componentType = namedtype.NamedTypes( + namedtype.NamedType('modulus', univ.Integer()), + namedtype.NamedType('publicExponent', univ.Integer()), + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/rsa/key.py new/rsa-3.1.2/rsa/key.py --- old/rsa-3.1.1/rsa/key.py 2012-01-29 11:42:03.000000000 +0100 +++ new/rsa-3.1.2/rsa/key.py 2013-09-15 12:30:48.000000000 +0200 @@ -26,7 +26,7 @@ ''' import logging -from rsa._compat import b +from rsa._compat import b, bytes_type import rsa.prime import rsa.pem @@ -34,6 +34,8 @@ log = logging.getLogger(__name__) + + class AbstractKey(object): '''Abstract superclass for private and public keys.''' @@ -153,16 +155,10 @@ ''' from pyasn1.codec.der import decoder - (priv, _) = decoder.decode(keyfile) - - # ASN.1 contents of DER encoded public key: - # - # RSAPublicKey ::= SEQUENCE { - # modulus INTEGER, -- n - # publicExponent INTEGER, -- e - - as_ints = tuple(int(x) for x in priv) - return cls(*as_ints) + from rsa.asn1 import AsnPubKey + + (priv, _) = decoder.decode(keyfile, asn1Spec=AsnPubKey()) + return cls(n=int(priv['modulus']), e=int(priv['publicExponent'])) def _save_pkcs1_der(self): '''Saves the public key in PKCS#1 DER format. @@ -170,14 +166,8 @@ @returns: the DER-encoded public key. ''' - from pyasn1.type import univ, namedtype from pyasn1.codec.der import encoder - - class AsnPubKey(univ.Sequence): - componentType = namedtype.NamedTypes( - namedtype.NamedType('modulus', univ.Integer()), - namedtype.NamedType('publicExponent', univ.Integer()), - ) + from rsa.asn1 import AsnPubKey # Create the ASN object asn_key = AsnPubKey() @@ -210,6 +200,47 @@ der = self._save_pkcs1_der() return rsa.pem.save_pem(der, 'RSA PUBLIC KEY') + @classmethod + def load_pkcs1_openssl_pem(cls, keyfile): + '''Loads a PKCS#1.5 PEM-encoded public key file from OpenSSL. + + These files can be recognised in that they start with BEGIN PUBLIC KEY + rather than BEGIN RSA PUBLIC KEY. + + The contents of the file before the "-----BEGIN PUBLIC KEY-----" and + after the "-----END PUBLIC KEY-----" lines is ignored. + + @param keyfile: contents of a PEM-encoded file that contains the public + key, from OpenSSL. + @return: a PublicKey object + ''' + + der = rsa.pem.load_pem(keyfile, 'PUBLIC KEY') + return cls.load_pkcs1_openssl_der(der) + + @classmethod + def load_pkcs1_openssl_der(cls, keyfile): + '''Loads a PKCS#1 DER-encoded public key file from OpenSSL. + + @param keyfile: contents of a DER-encoded file that contains the public + key, from OpenSSL. + @return: a PublicKey object + ''' + + from rsa.asn1 import OpenSSLPubKey + from pyasn1.codec.der import decoder + from pyasn1.type import univ + + (keyinfo, _) = decoder.decode(keyfile, asn1Spec=OpenSSLPubKey()) + + if keyinfo['header']['oid'] != univ.ObjectIdentifier('1.2.840.113549.1.1.1'): + raise TypeError("This is not a DER-encoded OpenSSL-compatible public key") + + return cls._load_pkcs1_der(keyinfo['key'][1:]) + + + + class PrivateKey(AbstractKey): '''Represents a private RSA key. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/rsa/pkcs1.py new/rsa-3.1.2/rsa/pkcs1.py --- old/rsa-3.1.1/rsa/pkcs1.py 2012-06-18 15:32:02.000000000 +0200 +++ new/rsa-3.1.2/rsa/pkcs1.py 2013-09-15 12:30:48.000000000 +0200 @@ -321,6 +321,8 @@ if message_hash != signature_hash: raise VerificationError('Verification failed') + return True + def _hash(message, method_name): '''Returns the message digest. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/rsa.egg-info/PKG-INFO new/rsa-3.1.2/rsa.egg-info/PKG-INFO --- old/rsa-3.1.1/rsa.egg-info/PKG-INFO 2012-06-18 17:17:02.000000000 +0200 +++ new/rsa-3.1.2/rsa.egg-info/PKG-INFO 2013-09-15 13:04:27.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: rsa -Version: 3.1.1 +Version: 3.1.2 Summary: Pure-Python RSA implementation Home-page: http://stuvel.eu/rsa Author: Sybren A. Stuvel @@ -15,4 +15,9 @@ Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.2 +Classifier: Programming Language :: Python :: 3.3 Classifier: Topic :: Security :: Cryptography diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/rsa.egg-info/SOURCES.txt new/rsa-3.1.2/rsa.egg-info/SOURCES.txt --- old/rsa-3.1.1/rsa.egg-info/SOURCES.txt 2012-06-18 17:17:02.000000000 +0200 +++ new/rsa-3.1.2/rsa.egg-info/SOURCES.txt 2013-09-15 13:04:27.000000000 +0200 @@ -1,7 +1,7 @@ LICENSE MANIFEST.in +README.rst create_timing_table.py -distribute_setup.py run_tests.py setup.cfg setup.py @@ -9,6 +9,7 @@ rsa/_compat.py rsa/_version133.py rsa/_version200.py +rsa/asn1.py rsa/bigfile.py rsa/cli.py rsa/common.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/rsa.egg-info/entry_points.txt new/rsa-3.1.2/rsa.egg-info/entry_points.txt --- old/rsa-3.1.1/rsa.egg-info/entry_points.txt 2012-06-18 17:17:02.000000000 +0200 +++ new/rsa-3.1.2/rsa.egg-info/entry_points.txt 2013-09-15 13:04:27.000000000 +0200 @@ -1,10 +1,10 @@ [console_scripts] -pyrsa-encrypt-bigfile = rsa.cli:encrypt_bigfile +pyrsa-decrypt-bigfile = rsa.cli:decrypt_bigfile +pyrsa-keygen = rsa.cli:keygen +pyrsa-decrypt = rsa.cli:decrypt +pyrsa-sign = rsa.cli:sign pyrsa-encrypt = rsa.cli:encrypt pyrsa-verify = rsa.cli:verify -pyrsa-sign = rsa.cli:sign pyrsa-priv2pub = rsa.util:private_to_public -pyrsa-decrypt = rsa.cli:decrypt -pyrsa-decrypt-bigfile = rsa.cli:decrypt_bigfile -pyrsa-keygen = rsa.cli:keygen +pyrsa-encrypt-bigfile = rsa.cli:encrypt_bigfile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/setup.cfg new/rsa-3.1.2/setup.cfg --- old/rsa-3.1.1/setup.cfg 2012-06-18 17:17:03.000000000 +0200 +++ new/rsa-3.1.2/setup.cfg 2013-09-15 13:04:27.000000000 +0200 @@ -2,7 +2,7 @@ verbosity = 2 [egg_info] +tag_svn_revision = 0 tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/setup.py new/rsa-3.1.2/setup.py --- old/rsa-3.1.1/setup.py 2012-06-18 16:14:17.000000000 +0200 +++ new/rsa-3.1.2/setup.py 2013-09-15 13:01:16.000000000 +0200 @@ -1,9 +1,5 @@ #!/usr/bin/env python -# Ensure that a reasonably recent version of 'distribute' is installed. -from distribute_setup import use_setuptools -use_setuptools('0.6.10') - from setuptools import setup import rsa @@ -26,6 +22,11 @@ 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', 'Topic :: Security :: Cryptography', ], install_requires=[ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/tests/test_bigfile.py new/rsa-3.1.2/tests/test_bigfile.py --- old/rsa-3.1.1/tests/test_bigfile.py 2012-01-29 11:42:03.000000000 +0100 +++ new/rsa-3.1.2/tests/test_bigfile.py 2013-09-15 12:30:48.000000000 +0200 @@ -51,7 +51,7 @@ # Check the signature msgfile.seek(0) - pkcs1.verify(msgfile, signature, pub_key) + self.assertTrue(pkcs1.verify(msgfile, signature, pub_key)) # Alter the message, re-check msgfile = BytesIO(b('123456sybren')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsa-3.1.1/tests/test_pkcs1.py new/rsa-3.1.2/tests/test_pkcs1.py --- old/rsa-3.1.1/tests/test_pkcs1.py 2012-01-29 11:42:03.000000000 +0100 +++ new/rsa-3.1.2/tests/test_pkcs1.py 2013-09-15 12:30:48.000000000 +0200 @@ -64,7 +64,7 @@ signature = pkcs1.sign(message, self.priv, 'SHA-256') print("\tSignature: %r" % signature) - pkcs1.verify(message, signature, self.pub) + self.assertTrue(pkcs1.verify(message, signature, self.pub)) def test_alter_message(self): '''Altering the message should let the verification fail.''' -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
