poly_pseudo 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fdab923c65e6f7879610f7942818cca80a8454eb
4
- data.tar.gz: ef974d8386486a49767e202a1ded93a98fb67bbf
3
+ metadata.gz: db1a8f78da752773735670a19e685efd975dc140
4
+ data.tar.gz: 8678187be0946d91649d98fda4686c770d316c62
5
5
  SHA512:
6
- metadata.gz: ca52fb9aeb48edcf19768067ad46d5b25f0e3091a3db70e3c62d67d6c89fb22b602b64a92f2be7599402b2bfca34089b65eb0a227cd0a0466b73708dd76368b2
7
- data.tar.gz: 4512bb3314f9b1493ca06be4b2e18418c34042f8eb4f184ba1762808f56e8fbd8621248727c39b19eb950002aa9b009b5208f018439f2aabf978231adcf3b6bc
6
+ metadata.gz: 2539348249868295f7b9ec29551898c9d5c0c9e1cdd0ee9570aa55d14b33b4fecd2a5e87c16e018d17a6b1073e7aa383de298d304a825436e38f204c4020aa71
7
+ data.tar.gz: a4be807bfa242730a125500ba2cf5f51867a2626bc7884fd3410f23cbbc3ba60352c4d631fbcd438333e05efa808e75c25bf18106a322b71ee8a6cfff5d33948
data/README.md CHANGED
@@ -25,6 +25,10 @@ Or install it yourself as:
25
25
  ```ruby
26
26
  require 'poly_pseudo'
27
27
 
28
+ identity_key = PolyPseudo::Util.read_key(File.read('EI_Decryption.pem'))
29
+ decryption_key = PolyPseudo::Util.read_key(File.read('EP_Decryption.pem'))
30
+ closing_key = PolyPseudo::Util.read_key(File.read('EP_Closing.pem'))
31
+
28
32
  encoded_asn1 = <<-BASE64
29
33
  MIIBVAYMYIQQAYdrg+MFAQIBAgEBAgEBFhQwMDAwMDAwNDAwMzIxNDM0NTAwMRYU
30
34
  MDAwMDAwMDMyNzMyMjYzMTAwMDACBAEzok4wgfkEUQQdTrTmvUoznOB+4bGfted+
@@ -38,10 +42,6 @@ BASE64
38
42
 
39
43
  identity_or_pseudonym = PolyPseudo::PseudoId.from_asn1(encoded_asn1)
40
44
 
41
- identity_key = PolyPseudo::Util.read_key(File.read('EI_Decryption.pem'))
42
- decryption_key = PolyPseudo::Util.read_key(File.read('EP_Decryption.pem'))
43
- closing_key = PolyPseudo::Util.read_key(File.read('EP_Closing.pem'))
44
-
45
45
  case identity_or_pseudonym
46
46
  when PolyPseudo::Identity
47
47
  identity_or_pseudonym.decrypt(identity_key)
@@ -12,13 +12,13 @@ module PolyPseudo
12
12
 
13
13
  private_key = key.ec.private_key
14
14
 
15
- identity_point = point_1.mul(private_key)
15
+ identity_point = point_1
16
+ .mul(private_key)
16
17
  .invert!
17
18
  .add(point_2)
18
19
  .make_affine!
19
20
 
20
- identity_point.x.to_s(16)
21
- @identity = Util.oaep_decode(identity_point.x.to_s(2)).slice(3, 10)
21
+ @identity = Util.oaep_decode(identity_point.x.to_s(2)).slice(3, 10).force_encoding("UTF-8").strip
22
22
  end
23
23
 
24
24
  def identity
@@ -11,7 +11,8 @@ module PolyPseudo
11
11
  product = decryption_private_key.mod_mul(closing_private_key, PolyPseudo.config.group.order)
12
12
  point_2_multiplied = point_2.mul(closing_private_key)
13
13
 
14
- pseudo_point = point_1.mul(product)
14
+ pseudo_point = point_1
15
+ .mul(product)
15
16
  .invert!
16
17
  .add(point_2_multiplied)
17
18
  .make_affine!
@@ -74,7 +74,7 @@ module PolyPseudo
74
74
  b2 = s2.unpack('c*')
75
75
 
76
76
  if b1.length != b2.length
77
- raise DecodeError, 'cannot xor strings of different lengths!'
77
+ raise 'cannot xor strings of different lengths!'
78
78
  end
79
79
 
80
80
  b1.zip(b2).map { |a, b| a ^ b }.pack('c*')
@@ -1,3 +1,3 @@
1
1
  module PolyPseudo
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poly_pseudo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoist Claassen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-01 00:00:00.000000000 Z
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler