trusts: replace use of python-crypto by m2crypto

python-crypto package is not available everywhere, use m2crypto instead.

Originally we thought to extend python-krbV to provide krb5_c_encrypt()
wrapper but m2crypto is readily available.

https://fedorahosted.org/freeipa/ticket/3271
This commit is contained in:
Alexander Bokovoy 2012-11-21 18:33:49 +02:00 committed by Rob Crittenden
parent f1f1b4e7f2
commit 7960b5c67f
2 changed files with 8 additions and 5 deletions

View File

@ -67,7 +67,7 @@ BuildRequires: sssd >= 1.8.0
BuildRequires: python-lxml
BuildRequires: python-pyasn1 >= 0.0.9a
BuildRequires: python-dns
BuildRequires: python-crypto
BuildRequires: m2crypto
BuildRequires: check
BuildRequires: libsss_idmap-devel
@ -181,7 +181,7 @@ daemons included in freeipa-server
Summary: Virtual package to install packages required for Active Directory trusts
Group: System Environment/Base
Requires: %{name}-server = %version-%release
Requires: python-crypto
Requires: m2crypto
%if 0%{?fedora} >= 18
Requires: samba-python
Requires: samba
@ -733,6 +733,9 @@ fi
%ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/ipa/ca.crt
%changelog
* Wed Nov 21 2012 Alexander Bokovoy <abokovoy@redhat.com> - 3.0.99-6
- Replace python-crypto by m2crypto dependency
* Fri Nov 16 2012 Rob Crittenden <rcritten@redhat.com> - 3.0.99-5
- Bump minimum version of slapi-nis to 0.44

View File

@ -41,7 +41,7 @@ from samba.ndr import ndr_pack
from samba import net
import samba
import random
from Crypto.Cipher import ARC4
from M2Crypto import RC4
try:
from ldap.controls import RequestControl as LDAPControl #pylint: disable=F0401
except ImportError:
@ -526,8 +526,8 @@ class TrustDomainInstance(object):
def generate_auth(self, trustdom_secret):
def arcfour_encrypt(key, data):
c = ARC4.new(key)
return c.encrypt(data)
c = RC4.RC4(key)
return c.update(data)
def string_to_array(what):
blob = [0] * len(what)