Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 602810 Details for
Bug 846370
Please port from python-crypto to python-nss
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch sent upstream
beaker-nss-crypto.patch (text/plain), 2.63 KB, created by
Miloslav Trmač
on 2012-08-07 17:00:06 UTC
(
hide
)
Description:
Patch sent upstream
Filename:
MIME Type:
Creator:
Miloslav Trmač
Created:
2012-08-07 17:00:06 UTC
Size:
2.63 KB
patch
obsolete
>Use python-nss instead of python-crypto. > >diff -urN Beaker/beaker/crypto/__init__.py Beaker-1.5.4/beaker/crypto/__init__.py >--- Beaker/beaker/crypto/__init__.py 2010-04-13 19:41:30.000000000 +0200 >+++ Beaker-1.5.4/beaker/crypto/__init__.py 2012-08-07 17:51:54.337744504 +0200 >@@ -14,10 +14,14 @@ > pass > else: > try: >- from beaker.crypto.pycrypto import getKeyLength, aesEncrypt, aesDecrypt >+ from beaker.crypto.nsscrypto import getKeyLength, aesEncrypt, aesDecrypt > keyLength = getKeyLength() > except ImportError: >- pass >+ try: >+ from beaker.crypto.pycrypto import getKeyLength, aesEncrypt, aesDecrypt >+ keyLength = getKeyLength() >+ except ImportError: >+ pass > > if not keyLength: > has_aes = False >diff -urN Beaker/beaker/crypto/nsscrypto.py Beaker-1.5.4/beaker/crypto/nsscrypto.py >--- Beaker/beaker/crypto/nsscrypto.py 1970-01-01 01:00:00.000000000 +0100 >+++ Beaker-1.5.4/beaker/crypto/nsscrypto.py 2012-08-07 18:07:24.221184184 +0200 >@@ -0,0 +1,45 @@ >+"""Encryption module that uses pycryptopp or pycrypto""" >+import nss.nss >+ >+nss.nss.nss_init_nodb() >+ >+# Apparently the rest of beaker doesn't care about the particluar cipher, >+# mode and padding used. >+# NOTE: A constant IV!!! This is only secure if the KEY is never reused!!! >+_mech = nss.nss.CKM_AES_CBC_PAD >+_iv = '\0' * nss.nss.get_iv_length(_mech) >+ >+def aesEncrypt(data, key): >+ slot = nss.nss.get_best_slot(_mech) >+ >+ key_obj = nss.nss.import_sym_key(slot, _mech, nss.nss.PK11_OriginGenerated, >+ nss.nss.CKA_ENCRYPT, nss.nss.SecItem(key)) >+ >+ param = nss.nss.param_from_iv(_mech, nss.nss.SecItem(_iv)) >+ ctx = nss.nss.create_context_by_sym_key(_mech, nss.nss.CKA_ENCRYPT, key_obj, >+ param) >+ l1 = ctx.cipher_op(data) >+ # Yes, DIGEST. This needs fixing in NSS, but apparently nobody (including >+ # me :( ) cares enough. >+ l2 = ctx.digest_final() >+ >+ return l1 + l2 >+ >+def aesDecrypt(data, key): >+ slot = nss.nss.get_best_slot(_mech) >+ >+ key_obj = nss.nss.import_sym_key(slot, _mech, nss.nss.PK11_OriginGenerated, >+ nss.nss.CKA_DECRYPT, nss.nss.SecItem(key)) >+ >+ param = nss.nss.param_from_iv(_mech, nss.nss.SecItem(_iv)) >+ ctx = nss.nss.create_context_by_sym_key(_mech, nss.nss.CKA_DECRYPT, key_obj, >+ param) >+ l1 = ctx.cipher_op(data) >+ # Yes, DIGEST. This needs fixing in NSS, but apparently nobody (including >+ # me :( ) cares enough. >+ l2 = ctx.digest_final() >+ >+ return l1 + l2 >+ >+def getKeyLength(): >+ return 32
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 846370
: 602810