Exemplo n.º 1
0
    def __init__(self, req, 
            tid='tid',
            cipher=0,
            key='k',
            hkey='hk',
            comp=0,
            maxage=500):    # 5 minutes

        # initialise SCS parameters
        self.s = scs.init(tid, cipher, key, hkey, comp, maxage)
        if self.s is None:
            raise Exception

        self.req = req            
Exemplo n.º 2
0
    def __init__(self,
                 req,
                 tid='tid',
                 cipher=0,
                 key='k',
                 hkey='hk',
                 comp=0,
                 maxage=500):  # 5 minutes

        # initialise SCS parameters
        self.s = scs.init(tid, cipher, key, hkey, comp, maxage)
        if self.s is None:
            raise Exception

        self.req = req
Exemplo n.º 3
0
    print 'decoded state: [', st, ']'

    if st != str:
        print '[err] input state different from decoded state!'
        raise Exception


# Run tests
s = None

try:
    # initialise SCS parameters
    s = scs.init(
            'tid', 
            0, 
            'k', 
            'hk', 
            0, 
            60);    #sessions may last at most 60 seconds 

    if s is None:
        print '[err]: ', scs.err(s)
        raise Exception

    # basic encoding/decoding tests
    test('some cool state 1')
    test('some other state 2')

    # test key refresh
    scs.refresh_keyset(s, 'tid2', 'k2', 'hk2')