Skip to content

Commit

Permalink
Minor code style adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
rayluo committed Dec 8, 2015
1 parent 96851f5 commit d539664
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions awscli/customizations/cloudfront.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SignCommand(BasicCommand):
YYYY-MM-DD (which means 0AM UTC of that day),
YYYY-MM-DDThh:mm:ss (with default timezone as UTC),
YYYY-MM-DDThh:mm:ss+hh:mm or YYYY-MM-DDThh:mm:ss-hh:mm (with offset),
or EpochTime.
or EpochTime (which always means UTC).
Do NOT use YYYYMMDD, because it will be treated as EpochTime."""
ARG_TABLE = [
{
Expand All @@ -58,7 +58,7 @@ class SignCommand(BasicCommand):

def _run_main(self, args, parsed_globals):
signer = CloudFrontSigner(
args.key_pair_id, RsaSigner(args.private_key).sign)
args.key_pair_id, RSASigner(args.private_key).sign)
date_less_than = parse_to_aware_datetime(args.date_less_than)
if args.date_greater_than is not None:
date_greater_than = parse_to_aware_datetime(args.date_greater_than)
Expand All @@ -74,8 +74,9 @@ def _run_main(self, args, parsed_globals):
return 0


class RsaSigner(object):
class RSASigner(object):
def __init__(self, private_key):
self.priv_key = rsa.PrivateKey.load_pkcs1(private_key.encode('utf8'))

def sign(self, message):
return rsa.sign(message, self.priv_key, 'SHA-1')
4 changes: 2 additions & 2 deletions awscli/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from awscli.customizations.rds import register_rds_modify_split
from awscli.customizations.putmetricdata import register_put_metric_data
from awscli.customizations.sessendemail import register_ses_send_email
from awscli.customizations.cloudfront import register as cloudfront_register
from awscli.customizations.cloudfront import register as register_cloudfront
from awscli.customizations.iamvirtmfa import IAMVMFAWrapper
from awscli.customizations.argrename import register_arg_renames
from awscli.customizations.configure import register_configure_cmd
Expand Down Expand Up @@ -109,7 +109,6 @@ def awscli_initialize(event_handlers):
register_rds_modify_split(event_handlers)
register_put_metric_data(event_handlers)
register_ses_send_email(event_handlers)
cloudfront_register(event_handlers)
IAMVMFAWrapper(event_handlers)
register_arg_renames(event_handlers)
register_configure_cmd(event_handlers)
Expand Down Expand Up @@ -142,3 +141,4 @@ def awscli_initialize(event_handlers):
event_handlers.register(
'building-argument-table.iot.create-certificate-from-csr',
register_create_keys_from_csr_arguments)
register_cloudfront(event_handlers)

0 comments on commit d539664

Please sign in to comment.