roqs 0.1.1 → 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.
- checksums.yaml +4 -4
- data/Dockerfile +11 -0
- data/README.md +20 -12
- data/lib/roqs/sig.rb +6 -0
- data/lib/roqs/version.rb +1 -1
- data/native/linux/x86_64/liboqs.so.0.10.0 +0 -0
- data/native/macos/.DS_Store +0 -0
- data/native/macos/arm64/liboqs.0.13.0.dylib +0 -0
- metadata +16 -9
- data/native/linux/x86_64/liboqs.so.0.9.0 +0 -0
- data/native/windows/x64/liboqs.dll +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb4196f529b63380781840381c6ba75df6546a0e179a0e46aa8ec62200ccba22
|
4
|
+
data.tar.gz: 4f871c35b07b8f2dd362ef7670e3a07ccec259249e1b0d9dea8f2b95c0ea2d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fefb69be1c948a373155c37ec0f42fc7c9582233cda8dd5ef9b2d2fa24683502e34e08d7fc52059cf9d6e1c58122c736fe4b11d82ccc652a5e45443020d55d9
|
7
|
+
data.tar.gz: 5bbb379f8d71561ac6d5c9625dedd9fa078d4db611b600183eed2189a8b79530191cf0a504d6bc03ab621089f3bff99676fd3f8ca15a921a8b265c5a26fdaad8
|
data/Dockerfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
FROM --platform=linux/x86_64 ubuntu:jammy
|
3
|
+
|
4
|
+
RUN apt-get update && apt-get install -y git curl build-essential software-properties-common gnupg2
|
5
|
+
|
6
|
+
RUN apt-add-repository -y ppa:rael-gc/rvm && apt-get update && apt-get install -y rvm
|
7
|
+
RUN /bin/bash -l -c ". /usr/share/rvm/scripts/rvm && rvm install ruby-3.2.1"
|
8
|
+
|
9
|
+
WORKDIR /opt
|
10
|
+
|
11
|
+
CMD ["/bin/bash","--login"]
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Roqs
|
2
2
|
|
3
3
|
Roqs is the Ruby wrapper to the [Open Quantum Safe library](https://openquantumsafe.org). The native library was tested against the liboqs at [liboqs](https://github.com/open-quantum-safe/liboqs)
|
4
|
+
|
5
|
+
Due to the direct invocation of the shared library via the libffi toolkit, unless there are major API changes at the liboqs side, this library will keep working as the library is just a bridge between liboqs and Ruby runtime via the API called. Any new supported algorithms internal to the liboqs can be just immediately utilized by the Ruby runtime.
|
6
|
+
|
4
7
|
## Installation
|
5
8
|
|
6
9
|
Add this line to your application's Gemfile:
|
@@ -11,23 +14,24 @@ gem 'roqs'
|
|
11
14
|
|
12
15
|
And then execute:
|
13
16
|
|
14
|
-
|
17
|
+
bundle install
|
15
18
|
|
16
19
|
Or install it yourself as:
|
17
20
|
|
18
|
-
|
21
|
+
gem install roqs
|
19
22
|
|
20
23
|
## Usage
|
21
24
|
|
22
|
-
OQS mainly only has two group of functions: Key Encapsulation Mechanism (KEM) and Signature (SIG).
|
25
|
+
OQS mainly only has two group of functions: Key Encapsulation Mechanism (KEM) and Signature (SIG).
|
23
26
|
|
24
|
-
Therefore the Ruby wrapper abstraction is following the liboqs C version as baseline.
|
27
|
+
Therefore the Ruby wrapper abstraction is following the liboqs C version as baseline.
|
25
28
|
|
26
29
|
### Key Encapsulation Mechanism (KEM)
|
27
30
|
|
28
31
|
For KEM, the API is simple:
|
29
32
|
|
30
|
-
1. List all supported KEM PQ algorithms - PQ algorithms can be enable or disabled at compile time so it all depends on the liboqs native library. This API listed down the algorithms which are *supported* as reported by the native library. If you're using your own version of the library, you might have different output.
|
33
|
+
1. List all supported KEM PQ algorithms - PQ algorithms can be enable or disabled at compile time so it all depends on the liboqs native library. This API listed down the algorithms which are *supported* as reported by the native library. If you're using your own version of the library, you might have different output.
|
34
|
+
|
31
35
|
```ruby
|
32
36
|
require 'roqs'
|
33
37
|
|
@@ -39,6 +43,7 @@ end
|
|
39
43
|
```
|
40
44
|
|
41
45
|
2. Generate keypair
|
46
|
+
|
42
47
|
```ruby
|
43
48
|
require 'roqs'
|
44
49
|
|
@@ -51,6 +56,7 @@ pubKey, secretKey = kyber.genkeypair
|
|
51
56
|
```
|
52
57
|
|
53
58
|
3. Key encapsulation - KEM is meant for key encapsulation which similar with Diffie-Hellman kind of key exchange
|
59
|
+
|
54
60
|
```ruby
|
55
61
|
require 'roqs'
|
56
62
|
|
@@ -61,6 +67,7 @@ sessionKey, cipher = kyber.derive_encapsulation_key(pubKey)
|
|
61
67
|
```
|
62
68
|
|
63
69
|
4. Key decapsulation - Re-generate the session key from the private key
|
70
|
+
|
64
71
|
```ruby
|
65
72
|
require 'roqs'
|
66
73
|
|
@@ -68,14 +75,14 @@ sessionKey = kyber.derive_decapsulation_key(cipher, secretKey)
|
|
68
75
|
# cipher is given by sender and privKey is the recipient own private key
|
69
76
|
```
|
70
77
|
|
71
|
-
|
72
|
-
|
78
|
+
*sessionKey* returned from derive\_encapsulation\_key() shall be same as the *sessionKey* from derive\_decapsulation\_key(). That session key shall be the AES key (any other symmetric key) for the data encryption.
|
73
79
|
|
74
80
|
### Signature mechanism
|
75
81
|
|
76
82
|
Signature mechanism is similar with KEM.
|
77
83
|
|
78
|
-
1. List all supported Signature PQ algorithms - It is same as KEM as algorithm can be turned on or off during compile time
|
84
|
+
1. List all supported Signature PQ algorithms - It is same as KEM as algorithm can be turned on or off during compile time
|
85
|
+
|
79
86
|
```ruby
|
80
87
|
require 'roqs'
|
81
88
|
|
@@ -87,6 +94,7 @@ end
|
|
87
94
|
```
|
88
95
|
|
89
96
|
2. Generate keypair
|
97
|
+
|
90
98
|
```ruby
|
91
99
|
require 'roqs'
|
92
100
|
|
@@ -98,8 +106,9 @@ pubKey, secretKey = dili.genkeypair
|
|
98
106
|
# Refer spec file for usage
|
99
107
|
```
|
100
108
|
|
101
|
-
3. Generate data signature
|
102
|
-
|
109
|
+
3. Generate data signature
|
110
|
+
|
111
|
+
```rubyion
|
103
112
|
require 'roqs'
|
104
113
|
|
105
114
|
# sign data using sender secretKey/private key
|
@@ -107,6 +116,7 @@ signature = dili.sign("this is message", secretKey)
|
|
107
116
|
```
|
108
117
|
|
109
118
|
4. Verify data signature
|
119
|
+
|
110
120
|
```ruby
|
111
121
|
require 'roqs'
|
112
122
|
|
@@ -117,7 +127,6 @@ res = dili.verify("this is message", signature, pubKey)
|
|
117
127
|
|
118
128
|
spec folder has the necessary API example usage.
|
119
129
|
|
120
|
-
|
121
130
|
## Test Results
|
122
131
|
|
123
132
|
Refer to [test result](https://github.com/chrisliaw/liboqs-ruby/blob/master/TEST-RESULT.md) for details.
|
@@ -125,4 +134,3 @@ Refer to [test result](https://github.com/chrisliaw/liboqs-ruby/blob/master/TEST
|
|
125
134
|
## License
|
126
135
|
|
127
136
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
128
|
-
|
data/lib/roqs/sig.rb
CHANGED
@@ -67,6 +67,7 @@ module Roqs
|
|
67
67
|
|
68
68
|
rv = SIGWrapper.OQS_SIG_verify(@struct, pMessage, message.length, pSignature, signature.length, pubKey)
|
69
69
|
|
70
|
+
logger.debug "Verify result : #{rv}"
|
70
71
|
rv == Roqs::OQS_SUCCESS
|
71
72
|
|
72
73
|
end
|
@@ -94,6 +95,11 @@ module Roqs
|
|
94
95
|
|
95
96
|
end
|
96
97
|
|
98
|
+
private
|
99
|
+
def logger
|
100
|
+
Roqs.logger(:sig)
|
101
|
+
end
|
102
|
+
|
97
103
|
end
|
98
104
|
|
99
105
|
end
|
data/lib/roqs/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roqs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: teLogger
|
@@ -52,7 +52,10 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.3.3
|
55
|
-
description:
|
55
|
+
description: Ruby wrapper for liboqs via direct shared library method invocation.
|
56
|
+
The wrapper is pretty stable since it is direct method invocation from shared library.
|
57
|
+
Any upgrade to the liboqs, after compiled to a shred library, roqs can immediately
|
58
|
+
utilize the upgraded library without any modification.
|
56
59
|
email:
|
57
60
|
- chris@antrapol.com
|
58
61
|
executables: []
|
@@ -61,6 +64,7 @@ extra_rdoc_files: []
|
|
61
64
|
files:
|
62
65
|
- ".rspec"
|
63
66
|
- ".rubocop.yml"
|
67
|
+
- Dockerfile
|
64
68
|
- README.md
|
65
69
|
- Rakefile
|
66
70
|
- TEST-RESULT.md
|
@@ -74,12 +78,15 @@ files:
|
|
74
78
|
- lib/roqs/struct.rb
|
75
79
|
- lib/roqs/version.rb
|
76
80
|
- lib/roqs/wrapper.rb
|
77
|
-
- native/linux/x86_64/liboqs.so.0.
|
78
|
-
- native/
|
81
|
+
- native/linux/x86_64/liboqs.so.0.10.0
|
82
|
+
- native/macos/.DS_Store
|
83
|
+
- native/macos/arm64/liboqs.0.13.0.dylib
|
79
84
|
- sig/roqs.rbs
|
80
|
-
homepage:
|
85
|
+
homepage: https://github.com/chrisliaw/roqs
|
81
86
|
licenses: []
|
82
|
-
metadata:
|
87
|
+
metadata:
|
88
|
+
homepage_uri: https://github.com/chrisliaw/roqs
|
89
|
+
source_code_uri: https://github.com/chrisliaw/roqs
|
83
90
|
post_install_message:
|
84
91
|
rdoc_options: []
|
85
92
|
require_paths:
|
@@ -95,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
102
|
- !ruby/object:Gem::Version
|
96
103
|
version: '0'
|
97
104
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.5.14
|
99
106
|
signing_key:
|
100
107
|
specification_version: 4
|
101
|
-
summary:
|
108
|
+
summary: Ruby wrapper for liboqs
|
102
109
|
test_files: []
|
Binary file
|
Binary file
|