This file is indexed.

/usr/lib/python2.7/dist-packages/libnacl/sign.py is in python-libnacl 1.5.0-1.

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
'''
High level routines to maintain signing keys and to sign and verify messages
'''
# Import libancl libs
import libnacl
import libnacl.base
import libnacl.encode


class Signer(libnacl.base.BaseKey):
    '''
    The tools needed to sign messages
    '''
    def __init__(self, seed=None):
        '''
        Create a signing key, if not seed it supplied a keypair is generated
        '''
        if seed:
            if len(seed) != libnacl.crypto_sign_SEEDBYTES:
                raise ValueError('Invalid seed bytes')
            self.vk, self.sk = libnacl.crypto_sign_seed_keypair(seed)
        else:
            seed = libnacl.randombytes(libnacl.crypto_sign_SEEDBYTES)
            self.vk, self.sk = libnacl.crypto_sign_seed_keypair(seed)
        self.seed = seed

    def sign(self, msg):
        '''
        Sign the given message with this key
        '''
        return libnacl.crypto_sign(msg, self.sk)

    def signature(self, msg):
        '''
        Return just the signature for the message
        '''
        return libnacl.crypto_sign(msg, self.sk)[:libnacl.crypto_sign_BYTES]


class Verifier(libnacl.base.BaseKey):
    '''
    Verify signed messages
    '''
    def __init__(self, vk_hex):
        '''
        Create a verification key from a hex encoded vkey
        '''
        self.vk = libnacl.encode.hex_decode(vk_hex)

    def verify(self, msg):
        '''
        Verify the message with tis key
        '''
        return libnacl.crypto_sign_open(msg, self.vk)