openssl-signature_algorithm 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -7
- data/lib/openssl/signature_algorithm/ecdsa.rb +18 -3
- data/lib/openssl/signature_algorithm/rsapkcs1.rb +11 -1
- data/lib/openssl/signature_algorithm/rsapss.rb +11 -1
- data/lib/openssl/signature_algorithm/version.rb +1 -1
- data/openssl-signature_algorithm.gemspec +7 -6
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b7bc92eb1796a3b0f57e24b861d0eab80d3889189b2dcf48988f205e9d81cd69
|
4
|
+
data.tar.gz: 365f011c31592f9d3d34a58a45b8ce3713227efbe5ea4a3bfc5fac0f87e68d14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f13ef1875e61ff4318e2888bba525388dbdddf6295a8eac737cfb02dc070a5d6de38b57297374368b1e8d0a8b1e380b6e1fa12c0d0c004a3300c1fe1d1763f6
|
7
|
+
data.tar.gz: 96f2e6e633eb38af1d5df34ca33d1428f5fee4ee7945eb92354e481810601a13ce689705aaea29f84984a78eb8e46619fe48b7a623a1c93239f7b8c5fc544ec0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.4.0] - 2020-01-31
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- `VerifyKey` serialization and deserialization for easy transmission over the network
|
8
|
+
|
3
9
|
## [v0.3.0] - 2020-01-30
|
4
10
|
|
5
11
|
### Added
|
@@ -26,6 +32,7 @@
|
|
26
32
|
- `OpenSSL::SignatureAlgorithm::RSAPSS`
|
27
33
|
- `OpenSSL::SignatureAlgorithm::RSAPKCS1`
|
28
34
|
|
35
|
+
[v0.4.0]: https://github.com/cedarcode/openssl-signature_algorithm/compare/v0.3.0...v0.4.0/
|
29
36
|
[v0.3.0]: https://github.com/cedarcode/openssl-signature_algorithm/compare/v0.2.0...v0.3.0/
|
30
37
|
[v0.2.0]: https://github.com/cedarcode/openssl-signature_algorithm/compare/v0.1.1...v0.2.0/
|
31
38
|
[v0.1.1]: https://github.com/cedarcode/openssl-signature_algorithm/compare/v0.1.0...v0.1.1/
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# OpenSSL::SignatureAlgorithm
|
2
2
|
|
3
|
-
|
3
|
+
Provides `OpenSSL::SignatureAlgorithm::ECDSA`, `OpenSSL::SignatureAlgorithm::RSAPSS`
|
4
|
+
and `OpenSSL::SignatureAlgorithm::RSAPKCS1` ruby object wrapers on top of `OpenSSL::PKey::EC`
|
5
|
+
and `OpenSSL::PKey::RSA`, so that you can reason in terms of signature algorithms when
|
6
|
+
signing and/or verifying signatures, instead of keys.
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
[![Gem](https://img.shields.io/gem/v/openssl-signature_algorithm.svg?style=flat-square)](https://rubygems.org/gems/openssl-signature_algorithm)
|
8
|
+
[![Gem](https://img.shields.io/gem/v/openssl-signature_algorithm.svg?style=flat-square&color=informational)](https://rubygems.org/gems/openssl-signature_algorithm)
|
8
9
|
[![Travis](https://img.shields.io/travis/cedarcode/openssl-signature_algorithm.svg?style=flat-square)](https://travis-ci.org/cedarcode/openssl-signature_algorithm)
|
9
10
|
|
10
11
|
## Installation
|
@@ -36,9 +37,10 @@ signing_key = algorithm.generate_signing_key
|
|
36
37
|
signature = algorithm.sign(to_be_signed)
|
37
38
|
|
38
39
|
# Signer sends verify key to Verifier
|
39
|
-
|
40
|
+
verify_key_string = signing_key.verify_key.serialize
|
40
41
|
|
41
42
|
# Verifier
|
43
|
+
verify_key = OpenSSL::SignatureAlgorithm::ECDSA::VerifyKey.deserialize(verify_key_string)
|
42
44
|
algorithm = OpenSSL::SignatureAlgorithm::ECDSA.new("256")
|
43
45
|
algorithm.verify_key = verify_key
|
44
46
|
algorithm.verify(signature, to_be_signed)
|
@@ -55,9 +57,10 @@ signing_key = algorithm.generate_signing_key
|
|
55
57
|
signature = algorithm.sign(to_be_signed)
|
56
58
|
|
57
59
|
# Signer sends verify key to Verifier
|
58
|
-
|
60
|
+
verify_key_string = signing_key.verify_key.serialize
|
59
61
|
|
60
62
|
# Verifier
|
63
|
+
verify_key = OpenSSL::SignatureAlgorithm::RSAPSS::VerifyKey.deserialize(verify_key_string)
|
61
64
|
algorithm = OpenSSL::SignatureAlgorithm::RSAPSS.new("256")
|
62
65
|
algorithm.verify_key = verify_key
|
63
66
|
algorithm.verify(signature, to_be_signed)
|
@@ -74,9 +77,10 @@ signing_key = algorithm.generate_signing_key
|
|
74
77
|
signature = algorithm.sign(to_be_signed)
|
75
78
|
|
76
79
|
# Signer sends verify key to Verifier
|
77
|
-
|
80
|
+
verify_key_string = signing_key.verify_key.serialize
|
78
81
|
|
79
82
|
# Verifier
|
83
|
+
verify_key = OpenSSL::SignatureAlgorithm::RSAPKCS1::VerifyKey.deserialize(verify_key_string)
|
80
84
|
algorithm = OpenSSL::SignatureAlgorithm::RSAPKCS1.new("256")
|
81
85
|
algorithm.verify_key = verify_key
|
82
86
|
algorithm.verify(signature, to_be_signed)
|
@@ -19,10 +19,25 @@ module OpenSSL
|
|
19
19
|
end
|
20
20
|
|
21
21
|
class VerifyKey < OpenSSL::PKey::EC::Point
|
22
|
-
def
|
23
|
-
|
24
|
-
|
22
|
+
def self.deserialize(pem_string)
|
23
|
+
new(OpenSSL::PKey::EC.new(pem_string).public_key)
|
24
|
+
end
|
25
|
+
|
26
|
+
def serialize
|
27
|
+
ec_key.to_pem
|
28
|
+
end
|
25
29
|
|
30
|
+
def ec_key
|
31
|
+
@ec_key ||=
|
32
|
+
begin
|
33
|
+
ec_key = OpenSSL::PKey::EC.new(group)
|
34
|
+
ec_key.public_key = self
|
35
|
+
|
36
|
+
ec_key
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def verify(*args)
|
26
41
|
ec_key.verify(*args)
|
27
42
|
end
|
28
43
|
end
|
@@ -8,7 +8,17 @@ module OpenSSL
|
|
8
8
|
class RSAPKCS1 < Base
|
9
9
|
class SigningKey < OpenSSL::PKey::RSA
|
10
10
|
def verify_key
|
11
|
-
public_key
|
11
|
+
VerifyKey.new(public_key.to_pem)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class VerifyKey < OpenSSL::PKey::RSA
|
16
|
+
class << self
|
17
|
+
alias_method :deserialize, :new
|
18
|
+
end
|
19
|
+
|
20
|
+
def serialize
|
21
|
+
to_pem
|
12
22
|
end
|
13
23
|
end
|
14
24
|
|
@@ -8,7 +8,17 @@ module OpenSSL
|
|
8
8
|
class RSAPSS < Base
|
9
9
|
class SigningKey < OpenSSL::PKey::RSA
|
10
10
|
def verify_key
|
11
|
-
public_key
|
11
|
+
VerifyKey.new(public_key.to_pem)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class VerifyKey < OpenSSL::PKey::RSA
|
16
|
+
class << self
|
17
|
+
alias_method :deserialize, :new
|
18
|
+
end
|
19
|
+
|
20
|
+
def serialize
|
21
|
+
to_pem
|
12
22
|
end
|
13
23
|
end
|
14
24
|
|
@@ -5,16 +5,17 @@ require_relative 'lib/openssl/signature_algorithm/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "openssl-signature_algorithm"
|
7
7
|
spec.version = OpenSSL::SignatureAlgorithm::VERSION
|
8
|
-
spec.authors = ["Gonzalo"]
|
8
|
+
spec.authors = ["Gonzalo Rodriguez"]
|
9
9
|
spec.email = ["gonzalo@cedarcode.com"]
|
10
10
|
spec.license = "Apache-2.0"
|
11
11
|
|
12
|
-
spec.summary = "
|
12
|
+
spec.summary = "OpenSSL::SignatureAlgorithm helpers for signing and verifying signatures with openssl ruby gem"
|
13
|
+
|
13
14
|
spec.description = <<-DESC
|
14
|
-
|
15
|
-
|
16
|
-
so that you can reason in terms of signature algorithms when
|
17
|
-
verifying signatures
|
15
|
+
Provides OpenSSL::SignatureAlgorithm::ECDSA, OpenSSL::SignatureAlgorithm::RSAPSS
|
16
|
+
and OpenSSL::SignatureAlgorithm::RSAPKCS1 ruby object wrapers on top of OpenSSL::PKey::EC
|
17
|
+
and OpenSSL::PKey::RSA, so that you can reason in terms of signature algorithms when
|
18
|
+
signing and/or verifying signatures, instead of keys.
|
18
19
|
DESC
|
19
20
|
|
20
21
|
spec.homepage = "https://github.com/cedarcode/openssl-signature_algorithm"
|
metadata
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openssl-signature_algorithm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Gonzalo
|
7
|
+
- Gonzalo Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
|
-
|
15
|
-
|
16
|
-
so that you can reason in terms of signature algorithms when
|
17
|
-
verifying signatures
|
14
|
+
Provides OpenSSL::SignatureAlgorithm::ECDSA, OpenSSL::SignatureAlgorithm::RSAPSS
|
15
|
+
and OpenSSL::SignatureAlgorithm::RSAPKCS1 ruby object wrapers on top of OpenSSL::PKey::EC
|
16
|
+
and OpenSSL::PKey::RSA, so that you can reason in terms of signature algorithms when
|
17
|
+
signing and/or verifying signatures, instead of keys.
|
18
18
|
email:
|
19
19
|
- gonzalo@cedarcode.com
|
20
20
|
executables: []
|
@@ -63,9 +63,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
|
67
|
-
rubygems_version: 2.6.14.4
|
66
|
+
rubygems_version: 3.1.2
|
68
67
|
signing_key:
|
69
68
|
specification_version: 4
|
70
|
-
summary:
|
69
|
+
summary: OpenSSL::SignatureAlgorithm helpers for signing and verifying signatures
|
70
|
+
with openssl ruby gem
|
71
71
|
test_files: []
|