Пример #1
0
    def test_string_to_sign(self):
        from faws.sign.v4 import string_to_sign
        when = datetime.datetime.strptime('20110909T233600Z', DATETIME_F)
        region = 'us-east-1'
        service = 'iam'
        cr_hash_value = '3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2'
        expected = '''AWS4-HMAC-SHA256
20110909T233600Z
20110909/us-east-1/iam/aws4_request
3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2'''
        actual = string_to_sign(region, service, cr_hash_value, when)
        self.assertSequenceEqual(expected, actual)
Пример #2
0
 def full_params(self, method, action, params, now):
     from faws.sign.v4 import (
         signature,
         cr_hash,
         signing_key,
         string_to_sign,
         )
     expires = now + datetime.timedelta(minutes=10)
     params = dict(params)
     params.update({
             'Action'           : action,
             'Version' : '2013-02-01',
             })
     params['Signature'] = signature(
         signing_key(self.creds.secret_key, now, self.creds.region, 'ec2'),
         string_to_sign(self.creds.region,
                        'ec2',
                        cr_hash(method, self.url, params, now),
                        now))