aws_cf_signer 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWQ4ZWM2YWZjNTI1ZDcyMzhhNGE5NjY4ODFjODIyNjQzNmVmY2JjYQ==
5
+ data.tar.gz: !binary |-
6
+ NzI5MWRhNTcwNTdiOTNkZmEwZTExZWRmNDNjYmUyM2EwNThjOWU0Yw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OGYwNzBmNThiMTA5MDNhMGIyNTUyZTdiNWYyYjI2ZjJhNzExMWUzMjQwZGM1
10
+ NmQxMTA0YThiMjNiMzdmYjc4MTMyMGU2MWI3NDIzMTQ1ZmIzOWEwODhmZTlh
11
+ NDRiNDRjOTc0YzI2MDcyMjM4MGQ4NDEwMGRmZDhiN2U3NDk2ZWQ=
12
+ data.tar.gz: !binary |-
13
+ YjRmYWUzYjIwNjVhYzI0MjE2NWM2OTU4OWIyNWIwZDc0NGIwOTBjYTZhMDk4
14
+ MTdhOGI3NTQxZmNlMGMyNzYxYTE3M2YxNzA4NjRhZjFjZWYzMmQwOTA5YjI4
15
+ YmQzNWRhYmYzNzYxMTAwYjFhNDJhMWI0ODAyNWI5MTY5YjM5Y2E=
data/README.md CHANGED
@@ -22,6 +22,9 @@ signer = AwsCfSigner.new('/path/to/my/pk-1234567890.pem')
22
22
  # If the key filename doesn't contain the key_pair_id (as it usually does from AWS), pass that in as the second arg
23
23
  signer = AwsCfSigner.new('/path/to/my/private-key.pem', '1234567890')
24
24
 
25
+ # If your private key is not on the filesystem, you can pass it explicitly, you need to pass key_pair_id if you do that
26
+ signer = AwsCfSigner.new(ENV["CLOUDFLARE_PRIVATE_KEY"], '1234567890')
27
+
25
28
  # expiration date is required
26
29
  # See Example Canned Policy at above AWS doc link
27
30
  url = signer.sign('http://d604721fxaaqy9.cloudfront.net/horizon.jpg?large=yes&license=yes', :ending => 'Sat, 14 Nov 2009 22:20:00 GMT')
@@ -76,4 +79,4 @@ Parts of signing code taken from a question on Stack Overflow asked by Ben Wisel
76
79
 
77
80
  ## License
78
81
 
79
- aws_cf_signer is distributed under the MIT License, copyright © 2010 STL
82
+ aws_cf_signer is distributed under the MIT License, copyright © 2010 STL, Dylan Vaughn
@@ -6,12 +6,17 @@ class AwsCfSigner
6
6
 
7
7
  attr_reader :key_pair_id
8
8
 
9
- def initialize(pem_path, key_pair_id = nil)
10
- @pem_path = pem_path
11
- @key = OpenSSL::PKey::RSA.new(File.readlines(@pem_path).join(""))
12
- @key_pair_id = key_pair_id ? key_pair_id : extract_key_pair_id(@pem_path)
13
- unless @key_pair_id
14
- raise ArgumentError.new("key_pair_id couldn't be inferred from #{@pem_path} - please pass in explicitly")
9
+ def initialize(key_or_pem_path, key_pair_id = nil)
10
+ if key_or_pem_path =~ /BEGIN RSA PRIVATE KEY/
11
+ @key = OpenSSL::PKey::RSA.new(key_or_pem_path)
12
+ @key_pair_id = key_pair_id or raise ArgumentError, "key_pair_id could not be inferred - please pass in explicitly"
13
+ else
14
+ @pem_path = key_or_pem_path
15
+ @key = OpenSSL::PKey::RSA.new(File.readlines(@pem_path).join(""))
16
+ @key_pair_id = key_pair_id ? key_pair_id : extract_key_pair_id(@pem_path)
17
+ unless @key_pair_id
18
+ raise ArgumentError.new("key_pair_id couldn't be inferred from #{@pem_path} - please pass in explicitly")
19
+ end
15
20
  end
16
21
  end
17
22
 
@@ -1,3 +1,3 @@
1
1
  class AwsCfSigner
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_cf_signer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dylan Vaughn
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-06 00:00:00.000000000 Z
11
+ date: 2014-05-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: thoughtbot-shoulda
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: yard
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,44 +48,42 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0.8'
62
55
  description:
63
56
  email:
64
- - dylan.vaughn@stlondemand.com
57
+ - dylancvaughn@gmail.com
65
58
  executables: []
66
59
  extensions: []
67
60
  extra_rdoc_files: []
68
61
  files:
69
- - lib/aws_cf_signer/version.rb
70
- - lib/aws_cf_signer.rb
71
62
  - README.md
72
- homepage: https://github.com/stlondemand/aws_cf_signer?source=c
63
+ - lib/aws_cf_signer.rb
64
+ - lib/aws_cf_signer/version.rb
65
+ homepage: https://github.com/dylanvaughn/aws_cf_signer
73
66
  licenses: []
67
+ metadata: {}
74
68
  post_install_message:
75
69
  rdoc_options: []
76
70
  require_paths:
77
71
  - lib
78
72
  required_ruby_version: !ruby/object:Gem::Requirement
79
- none: false
80
73
  requirements:
81
74
  - - ! '>='
82
75
  - !ruby/object:Gem::Version
83
76
  version: '0'
84
77
  required_rubygems_version: !ruby/object:Gem::Requirement
85
- none: false
86
78
  requirements:
87
79
  - - ! '>='
88
80
  - !ruby/object:Gem::Version
89
81
  version: '0'
90
82
  requirements: []
91
83
  rubyforge_project:
92
- rubygems_version: 1.8.23
84
+ rubygems_version: 2.2.2
93
85
  signing_key:
94
- specification_version: 3
86
+ specification_version: 4
95
87
  summary: Ruby gem for signing AWS Cloudfront URLs for serving private content.
96
88
  test_files: []
97
89
  has_rdoc: