/usr/lib/python2.7/dist-packages/celery/security/key.py is in python-celery 3.1.6-1ubuntu1.
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 | # -*- coding: utf-8 -*-
"""
celery.security.key
~~~~~~~~~~~~~~~~~~~
Private key for the security serializer.
"""
from __future__ import absolute_import
from kombu.utils.encoding import ensure_bytes
from .utils import crypto, reraise_errors
__all__ = ['PrivateKey']
class PrivateKey(object):
def __init__(self, key):
with reraise_errors('Invalid private key: {0!r}'):
self._key = crypto.load_privatekey(crypto.FILETYPE_PEM, key)
def sign(self, data, digest):
"""sign string containing data."""
with reraise_errors('Unable to sign data: {0!r}'):
return crypto.sign(self._key, ensure_bytes(data), digest)
|