pedicel-pay 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12084da10c8a033bfa52a0bb9ab055780a1985760044e98f964afec44143dc27
4
- data.tar.gz: 2c5c9b7e328b0ce6fb94b198a85e0212d503046b30f1e797145d0ebf343a3249
3
+ metadata.gz: 85d66f4d33714f24c34da1a20ae870a91b3dd0b91384384837d6800b465532c9
4
+ data.tar.gz: 351a005183dba34cc6e28ef1535291ad5cb491d488bdc00b44a44c83f1a1d1a8
5
5
  SHA512:
6
- metadata.gz: 66085fa5b654cd9bfe01a347865df7332435b4047ed0115a5cdff639ddd6fe524808cfc80f50aed1017eb454ac1c71f1191597cb1641f49c2d2915ae15de2ba7
7
- data.tar.gz: 0c4f411ea8648e9b86c848197a4e6a57b26b30f0ebd621f4c453a9af0686521c5b2f183c039a47b2a30c0b63d73759ebbdb1e8cbd3c9d3ac085e5a63f18425f5
6
+ metadata.gz: 6510894a8d6c86b1ecc979c5cfa6f411aaf2fe9fa09f3c70e1157d45fbff9e9ba0dd7b7d0f55049e3b6006055b25d95e3544dd22528807a7d30f28f20498b7c4
7
+ data.tar.gz: a4ccc1389c256f096ccd86eee3488b64e25664c03972044357709f5754f2518acc627f2cc155219f54790cf018bffaf3578dcba1715d964f57ae4ec7b3d12a0b
@@ -140,7 +140,7 @@ module PedicelPay
140
140
  else raise ArgumentError, 'invalid recipient'
141
141
  end
142
142
 
143
- ephemeral_seckey = OpenSSL::PKey::EC.new(PedicelPay::EC_CURVE).generate_key
143
+ ephemeral_seckey = OpenSSL::PKey::EC.generate(PedicelPay::EC_CURVE)
144
144
 
145
145
  [ephemeral_seckey.dh_compute_key(pubkey), ephemeral_seckey.public_key]
146
146
  end
@@ -158,8 +158,7 @@ module PedicelPay
158
158
  end
159
159
 
160
160
  def self.generate_ca(config: PedicelPay.config)
161
- key = OpenSSL::PKey::EC.new(PedicelPay::EC_CURVE)
162
- key.generate_key
161
+ key = OpenSSL::PKey::EC.generate(PedicelPay::EC_CURVE)
163
162
 
164
163
  cert = OpenSSL::X509::Certificate.new
165
164
  cert.version = 2 # https://www.ietf.org/rfc/rfc5280.txt -> Section 4.1, search for "v3(2)".
@@ -183,8 +182,7 @@ module PedicelPay
183
182
  end
184
183
 
185
184
  def self.generate_intermediate(ca_key:, ca_certificate:, config: PedicelPay.config)
186
- key = OpenSSL::PKey::EC.new(PedicelPay::EC_CURVE)
187
- key.generate_key
185
+ key = OpenSSL::PKey::EC.generate(PedicelPay::EC_CURVE)
188
186
 
189
187
  cert = OpenSSL::X509::Certificate.new
190
188
  # https://www.ietf.org/rfc/rfc5280.txt -> Section 4.1, search for "v3(2)".
@@ -216,8 +214,7 @@ module PedicelPay
216
214
  end
217
215
 
218
216
  def self.generate_leaf(intermediate_key:, intermediate_certificate:, config: PedicelPay.config)
219
- key = OpenSSL::PKey::EC.new(PedicelPay::EC_CURVE)
220
- key.generate_key
217
+ key = OpenSSL::PKey::EC.generate(PedicelPay::EC_CURVE)
221
218
 
222
219
  cert = OpenSSL::X509::Certificate.new
223
220
  cert.version = 2 # https://www.ietf.org/rfc/rfc5280.txt -> Section 4.1, search for "v3(2)".
@@ -13,8 +13,7 @@ module PedicelPay
13
13
  end
14
14
 
15
15
  def generate_key
16
- @key = OpenSSL::PKey::EC.new(PedicelPay::EC_CURVE)
17
- @key.generate_key
16
+ @key = OpenSSL::PKey::EC.generate(PedicelPay::EC_CURVE)
18
17
 
19
18
  @key
20
19
  end
@@ -9,11 +9,24 @@ module PedicelPay
9
9
  end
10
10
 
11
11
  def self.ec_key_to_pkey_public_key(ec_key)
12
- # EC#public_key is not a PKey public key, but an EC point.
13
- pub = OpenSSL::PKey::EC.new(ec_key.group)
14
- pub.public_key = ec_key.is_a?(OpenSSL::PKey::PKey) ? ec_key.public_key : ec_key
12
+ # OpenSSL::PKey::EC#public_key is not a PKey public key but an EC point.
13
+ # The ASN1 detour below is because OpenSSL < 3 does not have
14
+ # OpenSSL::PKey::EC#public_to_pem. Otherwise, this method could be served
15
+ # directly to OpenSSL::PKey::EC.new. An approach respecting the
16
+ # immutability of a PKey and the potential absence of #public_to_pem
17
+ # is necessary. See https://stackoverflow.com/a/75572569.
18
+ point = ec_key.is_a?(OpenSSL::PKey::PKey) ? ec_key.public_key : ec_key
19
+ asn1 = OpenSSL::ASN1::Sequence(
20
+ [
21
+ OpenSSL::ASN1::Sequence([
22
+ OpenSSL::ASN1::ObjectId('id-ecPublicKey'),
23
+ OpenSSL::ASN1::ObjectId(ec_key.group.curve_name)
24
+ ]),
25
+ OpenSSL::ASN1::BitString(point.to_octet_string(:uncompressed))
26
+ ]
27
+ )
15
28
 
16
- pub
29
+ OpenSSL::PKey::EC.new(asn1.to_der)
17
30
  end
18
31
 
19
32
  def self.bytestring_to_hex(string)
@@ -1,3 +1,3 @@
1
1
  module PedicelPay
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pedicel-pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clearhaus A/S
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-14 00:00:00.000000000 Z
11
+ date: 2023-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 2.1.4
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 2.1.4
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -44,43 +30,29 @@ dependencies:
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: 1.0.0
33
+ version: 1.2.0
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: 1.0.0
40
+ version: 1.2.0
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: thor
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.20'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.20'
69
- - !ruby/object:Gem::Dependency
70
- name: openssl
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
45
+ - - ">="
74
46
  - !ruby/object:Gem::Version
75
- version: '2.1'
47
+ version: '0'
76
48
  type: :runtime
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
- - - "~>"
52
+ - - ">="
81
53
  - !ruby/object:Gem::Version
82
- version: '2.1'
83
- description:
54
+ version: '0'
55
+ description:
84
56
  email: hello@clearhaus.com
85
57
  executables:
86
58
  - pedicel-pay
@@ -100,7 +72,7 @@ homepage: https://github.com/clearhaus/pedicel-pay
100
72
  licenses:
101
73
  - MIT
102
74
  metadata: {}
103
- post_install_message:
75
+ post_install_message:
104
76
  rdoc_options: []
105
77
  require_paths:
106
78
  - lib
@@ -115,8 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
87
  - !ruby/object:Gem::Version
116
88
  version: '0'
117
89
  requirements: []
118
- rubygems_version: 3.1.6
119
- signing_key:
90
+ rubygems_version: 3.3.26
91
+ signing_key:
120
92
  specification_version: 4
121
93
  summary: Backend and client part of Apple Pay
122
94
  test_files: []