Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 611600
Collapse All | Expand All

(-)a/docs/index.rst (-5 lines)
Lines 22-32 Welcome to keyrings.alt documentation! Link Here
22
    :undoc-members:
22
    :undoc-members:
23
    :show-inheritance:
23
    :show-inheritance:
24
24
25
.. automodule:: keyrings.alt.keyczar
26
    :members:
27
    :undoc-members:
28
    :show-inheritance:
29
30
.. automodule:: keyrings.alt.multi
25
.. automodule:: keyrings.alt.multi
31
    :members:
26
    :members:
32
    :undoc-members:
27
    :undoc-members:
(-)a/keyrings/alt/Google.py (-27 lines)
Lines 15-21 try: Link Here
15
except ImportError:
15
except ImportError:
16
    pass
16
    pass
17
17
18
from . import keyczar
19
from keyring import errors
18
from keyring import errors
20
from keyring import credentials
19
from keyring import credentials
21
from keyring.backend import KeyringBackend
20
from keyring.backend import KeyringBackend
Lines 69-76 class DocsKeyring(KeyringBackend): Link Here
69
    def priority(cls):
68
    def priority(cls):
70
        if not cls._has_gdata():
69
        if not cls._has_gdata():
71
            raise RuntimeError("Requires gdata")
70
            raise RuntimeError("Requires gdata")
72
        if not keyczar.has_keyczar():
73
            raise RuntimeError("Requires keyczar")
74
        return 3
71
        return 3
75
72
76
    @classmethod
73
    @classmethod
Lines 297-323 class DocsKeyring(KeyringBackend): Link Here
297
                result = self.FAIL
294
                result = self.FAIL
298
295
299
        return result
296
        return result
300
301
class KeyczarDocsKeyring(DocsKeyring):
302
    """Google Docs keyring using keyczar initialized from environment
303
    variables
304
    """
305
306
    def __init__(self):
307
        crypter = keyczar.EnvironCrypter()
308
        credential = EnvironCredential()
309
        source = os.environ.get('GOOGLE_KEYRING_SOURCE')
310
        super(KeyczarDocsKeyring, self).__init__(
311
            credential, source, crypter)
312
313
    def supported(self):
314
        """Return if this keyring supports current environment:
315
        -1: not applicable
316
         0: suitable
317
         1: recommended
318
        """
319
        try:
320
            from keyczar import keyczar
321
            return super(KeyczarDocsKeyring, self).supported()
322
        except ImportError:
323
            return -1
(-)a/keyrings/alt/file.py (-3 / +3 lines)
Lines 37-43 class PlaintextKeyring(Keyring): Link Here
37
37
38
class Encrypted(object):
38
class Encrypted(object):
39
    """
39
    """
40
    PyCrypto-backed Encryption support
40
    Pycryptodome-backed Encryption support
41
    """
41
    """
42
    scheme = '[PBKDF2] AES256.CFB'
42
    scheme = '[PBKDF2] AES256.CFB'
43
    version = '1.0'
43
    version = '1.0'
Lines 68-74 class Encrypted(object): Link Here
68
68
69
69
70
class EncryptedKeyring(Encrypted, Keyring):
70
class EncryptedKeyring(Encrypted, Keyring):
71
    """PyCrypto File Keyring"""
71
    """Cryptodome File Keyring"""
72
72
73
    filename = 'crypted_pass.cfg'
73
    filename = 'crypted_pass.cfg'
74
    pw_prefix = 'pw:'.encode()
74
    pw_prefix = 'pw:'.encode()
Lines 82-88 class EncryptedKeyring(Encrypted, Keyring): Link Here
82
            __import__('Crypto.Protocol.KDF')
82
            __import__('Crypto.Protocol.KDF')
83
            __import__('Crypto.Random')
83
            __import__('Crypto.Random')
84
        except ImportError:     # pragma: no cover
84
        except ImportError:     # pragma: no cover
85
            raise RuntimeError("PyCrypto required")
85
            raise RuntimeError("Pycryptodome required")
86
        if not json:            # pragma: no cover
86
        if not json:            # pragma: no cover
87
            raise RuntimeError("JSON implementation such as simplejson "
87
            raise RuntimeError("JSON implementation such as simplejson "
88
                "required.")
88
                "required.")
(-)a/keyrings/alt/pyfs.py (-10 lines)
Lines 8-14 from keyring import errors Link Here
8
from keyring.util.escape import escape as escape_for_ini
8
from keyring.util.escape import escape as escape_for_ini
9
from keyring.util import platform_, properties
9
from keyring.util import platform_, properties
10
from keyring.backend import KeyringBackend, NullCrypter
10
from keyring.backend import KeyringBackend, NullCrypter
11
from . import keyczar
12
11
13
try:
12
try:
14
    import fs.opener
13
    import fs.opener
Lines 261-272 class EncryptedKeyring(BasicKeyring): Link Here
261
        super(EncryptedKeyring, self).__init__(
260
        super(EncryptedKeyring, self).__init__(
262
            crypter, filename=filename, can_create=can_create,
261
            crypter, filename=filename, can_create=can_create,
263
            cache_timeout=cache_timeout)
262
            cache_timeout=cache_timeout)
264
265
class KeyczarKeyring(EncryptedKeyring):
266
    """Encrypted Pyfilesystem Keyring using Keyczar keysets specified in
267
    environment vars
268
    """
269
270
    def __init__(self):
271
        super(KeyczarKeyring, self).__init__(
272
            keyczar.EnvironCrypter())
(-)a/setup.py (-1 / +1 lines)
Lines 26-31 params = dict( Link Here
26
    python_requires='>=2.7',
26
    python_requires='>=2.7',
27
    install_requires=[
27
    install_requires=[
28
        'six',
28
        'six',
29
        'pycryptodome'
29
    ],
30
    ],
30
    extras_require={
31
    extras_require={
31
    },
32
    },
Lines 44-50 params = dict( Link Here
44
            'file = keyrings.alt.file',
45
            'file = keyrings.alt.file',
45
            'Gnome = keyrings.alt.Gnome',
46
            'Gnome = keyrings.alt.Gnome',
46
            'Google = keyrings.alt.Google',
47
            'Google = keyrings.alt.Google',
47
            'keyczar = keyrings.alt.keyczar',
48
            'multi = keyrings.alt.multi',
48
            'multi = keyrings.alt.multi',
49
            'pyfs = keyrings.alt.pyfs',
49
            'pyfs = keyrings.alt.pyfs',
50
            'Windows (alt) = keyrings.alt.Windows',
50
            'Windows (alt) = keyrings.alt.Windows',
(-)a/tests/requirements.txt (-6 / +1 lines)
Lines 4-16 backports.unittest_mock Link Here
4
keyring[test] >= 10.3.1
4
keyring[test] >= 10.3.1
5
5
6
fs>=0.5,<2
6
fs>=0.5,<2
7
pycrypto
7
pycryptodome
8
8
9
# gdata doesn't currently install on Python 3
9
# gdata doesn't currently install on Python 3
10
# http://code.google.com/p/gdata-python-client/issues/detail?id=229
10
# http://code.google.com/p/gdata-python-client/issues/detail?id=229
11
gdata; python_version=="2.7"
11
gdata; python_version=="2.7"
12
13
14
# keyczar doesn't currently install on Python 3.
15
# http://code.google.com/p/keyczar/issues/detail?id=125
16
python-keyczar; python_version=="2.7"
(-)a/tests/test_Google.py (-2 / +2 lines)
Lines 10-16 from keyrings.alt import Google Link Here
10
from keyring.credentials import SimpleCredential
10
from keyring.credentials import SimpleCredential
11
from keyring.backend import NullCrypter
11
from keyring.backend import NullCrypter
12
from keyring import errors
12
from keyring import errors
13
from . import mocks
13
import mocks
14
14
15
def is_gdata_supported():
15
def is_gdata_supported():
16
    try:
16
    try:
Lines 58-64 class GoogleDocsKeyringInteractionTestCase(unittest.TestCase): Link Here
58
        listfeed = mocks.MockListFeed()
58
        listfeed = mocks.MockListFeed()
59
        listfeed._entry = [mocks.MockDocumentListEntry(),
59
        listfeed._entry = [mocks.MockDocumentListEntry(),
60
                           mocks.MockDocumentListEntry()
60
                           mocks.MockDocumentListEntry()
61
                          ]
61
                           ]
62
        return listfeed
62
        return listfeed
63
63
64
    def _encode_data(self, data):
64
    def _encode_data(self, data):
(-)a/tests/test_crypto.py (-1 / +1 lines)
Lines 1-7 Link Here
1
import unittest
1
import unittest
2
from unittest import mock
2
from unittest import mock
3
3
4
from .test_file import FileKeyringTests
4
from test_file import FileKeyringTests
5
5
6
from keyrings.alt import file
6
from keyrings.alt import file
7
7

Return to bug 611600