/usr/share/pyshared/celery/security/key.py is in python-celery 2.5.3-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from __future__ import absolute_import
import sys
try:
from OpenSSL import crypto
except ImportError:
crypto = None # noqa
from ..exceptions import SecurityError
class PrivateKey(object):
def __init__(self, key):
assert crypto is not None
try:
self._key = crypto.load_privatekey(crypto.FILETYPE_PEM, key)
except crypto.Error, exc:
raise SecurityError, SecurityError(
"Invalid private key: %r" % (exc, )), sys.exc_info()[2]
def sign(self, data, digest):
"""sign string containing data."""
try:
return crypto.sign(self._key, data, digest)
except crypto.Error, exc:
raise SecurityError, SecurityError(
"Unable to sign data: %r" % (exc, )), sys.exc_info()[2]
|