ccrypto 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.release_history.yml +2 -0
- data/.rubocop.yml +2 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +43 -29
- data/Rakefile +1 -2
- data/ccrypto.gemspec +3 -1
- data/lib/ccrypto/capability.rb +15 -0
- data/lib/ccrypto/configs/algo_config.rb +5 -5
- data/lib/ccrypto/configs/cipher_config.rb +41 -98
- data/lib/ccrypto/configs/digest_config.rb +89 -78
- data/lib/ccrypto/configs/hmac_config.rb +8 -3
- data/lib/ccrypto/configs/kdf_config.rb +73 -11
- data/lib/ccrypto/configs/key_config.rb +8 -1
- data/lib/ccrypto/configs/keypair_config.rb +93 -14
- data/lib/ccrypto/configs/secret_sharing_config.rb +7 -0
- data/lib/ccrypto/configs/x509_cert_profile.rb +10 -7
- data/lib/ccrypto/configs/x509_csr_profile.rb +1 -1
- data/lib/ccrypto/digest_matcher.rb +122 -0
- data/lib/ccrypto/in_memory_record.rb +255 -0
- data/lib/ccrypto/key_bundle.rb +20 -1
- data/lib/ccrypto/keystore.rb +25 -0
- data/lib/ccrypto/private_key.rb +8 -0
- data/lib/ccrypto/public_key.rb +13 -0
- data/lib/ccrypto/secret_key.rb +9 -4
- data/lib/ccrypto/supported_cipher_list.rb +6 -127
- data/lib/ccrypto/version.rb +1 -1
- data/lib/ccrypto/x509_cert.rb +5 -0
- data/lib/ccrypto/x509_csr.rb +2 -0
- data/lib/ccrypto.rb +41 -0
- metadata +12 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9be6eb61015364e145f1607c28f3001a73c84c08fb0e31a1acdc50fd5fc343a3
|
4
|
+
data.tar.gz: cf2b5b56fca36ce1edc1dedc49979170d362676a9ced1db2cffeb16f8cd6e49a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8bd46f24aa6bd03e7d303681d4013e416f16faf181d63dd4ea61cf0b14f897be029f0badbea9169fc156dfea07df65863661135009fc5b25c312af0b9d73777
|
7
|
+
data.tar.gz: 56d3a26f498225721ead8d36a6fee0e875e660840a7eda072087941d2ed583548c16a1d8acfe71563f5bd9bba834e484cc52db5400230c369f23a8c632e8367b
|
data/.release_history.yml
CHANGED
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ccrypto (0.
|
4
|
+
ccrypto (0.2.0)
|
5
5
|
activesupport
|
6
6
|
teLogger
|
7
7
|
toolrack
|
@@ -9,53 +9,64 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (7.
|
12
|
+
activesupport (7.1.2)
|
13
|
+
base64
|
14
|
+
bigdecimal
|
13
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
connection_pool (>= 2.2.5)
|
17
|
+
drb
|
14
18
|
i18n (>= 1.6, < 2)
|
15
19
|
minitest (>= 5.1)
|
20
|
+
mutex_m
|
16
21
|
tzinfo (~> 2.0)
|
22
|
+
base64 (0.2.0)
|
23
|
+
bigdecimal (3.1.5)
|
24
|
+
bigdecimal (3.1.5-java)
|
25
|
+
colorize (1.1.0)
|
17
26
|
concurrent-ruby (1.2.2)
|
18
|
-
|
19
|
-
git_cli
|
20
|
-
git_cli_prompt (~> 0.3.3)
|
21
|
-
gvcs
|
22
|
-
teLogger
|
23
|
-
toolrack
|
24
|
-
tty-prompt
|
27
|
+
connection_pool (2.4.1)
|
25
28
|
diff-lcs (1.5.0)
|
26
|
-
|
27
|
-
|
29
|
+
drb (2.2.0)
|
30
|
+
ruby2_keywords
|
31
|
+
git_cli (0.13.9)
|
28
32
|
ptools (~> 1.4.0)
|
29
|
-
teLogger
|
30
|
-
toolrack
|
31
|
-
|
32
|
-
teLogger
|
33
|
-
toolrack
|
34
|
-
tty-prompt
|
35
|
-
gvcs (0.1.1)
|
36
|
-
i18n (1.12.0)
|
33
|
+
teLogger (> 0.2)
|
34
|
+
toolrack (> 0.23)
|
35
|
+
i18n (1.14.1)
|
37
36
|
concurrent-ruby (~> 1.0)
|
38
|
-
minitest (5.
|
37
|
+
minitest (5.20.0)
|
38
|
+
mutex_m (0.2.0)
|
39
39
|
pastel (0.8.0)
|
40
40
|
tty-color (~> 0.5)
|
41
41
|
ptools (1.4.3)
|
42
|
-
rake (13.0
|
42
|
+
rake (13.1.0)
|
43
|
+
release-gem (0.3.3)
|
44
|
+
colorize (~> 1.1)
|
45
|
+
git_cli (~> 0.13)
|
46
|
+
pastel (~> 0.8)
|
47
|
+
teLogger (~> 0.2)
|
48
|
+
toolrack (~> 0.23)
|
49
|
+
tty-command (~> 0.10)
|
50
|
+
tty-prompt (~> 0.23)
|
43
51
|
rspec (3.12.0)
|
44
52
|
rspec-core (~> 3.12.0)
|
45
53
|
rspec-expectations (~> 3.12.0)
|
46
54
|
rspec-mocks (~> 3.12.0)
|
47
|
-
rspec-core (3.12.
|
55
|
+
rspec-core (3.12.2)
|
48
56
|
rspec-support (~> 3.12.0)
|
49
|
-
rspec-expectations (3.12.
|
57
|
+
rspec-expectations (3.12.3)
|
50
58
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
59
|
rspec-support (~> 3.12.0)
|
52
|
-
rspec-mocks (3.12.
|
60
|
+
rspec-mocks (3.12.6)
|
53
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
62
|
rspec-support (~> 3.12.0)
|
55
|
-
rspec-support (3.12.
|
63
|
+
rspec-support (3.12.1)
|
64
|
+
ruby2_keywords (0.0.5)
|
56
65
|
teLogger (0.2.2)
|
57
|
-
toolrack (0.
|
66
|
+
toolrack (0.24.1)
|
58
67
|
tty-color (0.6.0)
|
68
|
+
tty-command (0.10.1)
|
69
|
+
pastel (~> 0.8)
|
59
70
|
tty-cursor (0.7.1)
|
60
71
|
tty-prompt (0.23.1)
|
61
72
|
pastel (~> 0.8)
|
@@ -64,20 +75,23 @@ GEM
|
|
64
75
|
tty-cursor (~> 0.7)
|
65
76
|
tty-screen (~> 0.8)
|
66
77
|
wisper (~> 2.0)
|
67
|
-
tty-screen (0.8.
|
78
|
+
tty-screen (0.8.2)
|
68
79
|
tzinfo (2.0.6)
|
69
80
|
concurrent-ruby (~> 1.0)
|
70
81
|
wisper (2.0.1)
|
71
82
|
|
72
83
|
PLATFORMS
|
73
84
|
ruby
|
85
|
+
universal-java-1.8
|
86
|
+
universal-java-11
|
87
|
+
universal-java-17
|
74
88
|
x86_64-linux
|
75
89
|
|
76
90
|
DEPENDENCIES
|
77
91
|
ccrypto!
|
78
|
-
devops_assist
|
79
92
|
rake (~> 13.0)
|
93
|
+
release-gem
|
80
94
|
rspec (~> 3.0)
|
81
95
|
|
82
96
|
BUNDLED WITH
|
83
|
-
2.
|
97
|
+
2.5.1
|
data/Rakefile
CHANGED
data/ccrypto.gemspec
CHANGED
@@ -35,11 +35,13 @@ Gem::Specification.new do |spec|
|
|
35
35
|
|
36
36
|
spec.add_dependency 'activesupport'
|
37
37
|
|
38
|
-
spec.add_development_dependency 'devops_assist'
|
38
|
+
#spec.add_development_dependency 'devops_assist'
|
39
|
+
#spec.add_development_dependency 'pry'
|
39
40
|
|
40
41
|
# Uncomment to register a new dependency of your gem
|
41
42
|
# spec.add_dependency "example-gem", "~> 1.0"
|
42
43
|
|
43
44
|
# For more information and examples about making a new gem, checkout our
|
44
45
|
# guide at: https://bundler.io/guides/creating_gem.html
|
46
|
+
spec.add_development_dependency 'release-gem'
|
45
47
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Ccrypto
|
4
|
+
module Capability
|
5
|
+
|
6
|
+
def self.supported_keypair_config(*args,&block)
|
7
|
+
Provider.instance.provider.supported_keypair_config(*args, &block)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.supported_secret_key_config(*args, &block)
|
11
|
+
Provider.instance.provider.supported_secret_key_config(*args, &block)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -10,11 +10,11 @@ module Ccrypto
|
|
10
10
|
klass.extend(ClassMethods)
|
11
11
|
end
|
12
12
|
|
13
|
-
attr_accessor :provider_config
|
14
|
-
def provider_info(val)
|
15
|
-
|
16
|
-
|
17
|
-
end
|
13
|
+
#attr_accessor :provider_config
|
14
|
+
#def provider_info(val)
|
15
|
+
# @provider_config = val
|
16
|
+
# self
|
17
|
+
#end
|
18
18
|
|
19
19
|
end
|
20
20
|
end
|
@@ -2,21 +2,16 @@
|
|
2
2
|
|
3
3
|
module Ccrypto
|
4
4
|
|
5
|
-
module CipherAuthMode
|
6
|
-
attr_accessor :auth_data, :auth_tag
|
7
|
-
end
|
8
|
-
|
9
5
|
class CipherConfig
|
10
6
|
include AlgoConfig
|
11
7
|
include TR::CondUtils
|
12
8
|
|
13
|
-
|
14
|
-
attr_accessor :
|
15
|
-
attr_accessor :iv, :ivLength
|
16
|
-
attr_accessor :cipherOps
|
9
|
+
# given later by the provider
|
10
|
+
attr_accessor :ccrypto_key, :iv
|
17
11
|
|
18
|
-
#
|
19
|
-
|
12
|
+
# set while this config is initialize and should not be changed
|
13
|
+
attr_reader :algo, :padding, :mode
|
14
|
+
attr_reader :keysize, :ivLength
|
20
15
|
|
21
16
|
# Use cases :
|
22
17
|
# openssl aes-128-xts only accepts input min 16 bytes
|
@@ -24,82 +19,49 @@ module Ccrypto
|
|
24
19
|
attr_reader :min_input_length, :mandatory_block_size
|
25
20
|
|
26
21
|
# provider specific
|
27
|
-
attr_accessor :
|
22
|
+
attr_accessor :provider_config
|
23
|
+
|
24
|
+
# construct a standard key config for key generation engine
|
25
|
+
attr_accessor :key_config
|
28
26
|
|
29
27
|
def initialize(algo, opts = { }, &block)
|
30
28
|
@algo = algo
|
31
29
|
|
32
|
-
@logger = Tlogger.new
|
33
|
-
@logger.tag = :cipher_conf
|
34
|
-
|
35
30
|
@authMode = false
|
36
31
|
@plaintext_length = 0
|
37
32
|
@ciphertext_length = 0
|
38
33
|
@min_input_length = -1
|
39
|
-
@
|
34
|
+
@mandatory_block_size = -1
|
40
35
|
@fixed_iv_length = -1
|
41
36
|
|
42
37
|
if not_empty?(opts) and opts.is_a?(Hash)
|
43
38
|
@mode = opts[:mode]
|
44
|
-
|
39
|
+
|
45
40
|
@authMode = opts[:authMode] || false
|
46
|
-
#if is_mode?(:gcm)
|
47
|
-
if @authMode
|
48
|
-
self.extend CipherAuthMode
|
49
|
-
@logger.debug "Extending auth mode"
|
50
|
-
|
51
|
-
@auth_data = opts[:auth_data]
|
52
|
-
@auth_tag = opts[:auth_tag]
|
53
|
-
|
54
|
-
end
|
55
41
|
|
56
42
|
@iv = opts[:iv]
|
57
43
|
@ivLength = opts[:ivLength] if is_empty?(@iv)
|
58
44
|
|
59
|
-
@
|
60
|
-
@keysize = opts[:keysize] if is_empty?(@key)
|
45
|
+
@iv_required = (@ivLength.nil? ? false : @ivLength.to_i > 0)
|
61
46
|
|
62
|
-
@
|
47
|
+
@ccrypto_key = opts[:ccrypto_key]
|
48
|
+
@keysize = opts[:keysize] if is_empty?(@ccrypto_key)
|
63
49
|
|
64
|
-
@
|
50
|
+
@padding = opts[:padding]
|
65
51
|
|
66
52
|
@min_input_length = opts[:min_input_length] || -1
|
67
53
|
|
68
54
|
@mandatory_block_size = opts[:mandatory_block_size] || -1
|
69
55
|
|
70
|
-
|
56
|
+
#@fixed_auth_tag_length = opts[:fixed_auth_tag_length] || -1
|
71
57
|
|
58
|
+
@provider_config = opts[:provider_config]
|
72
59
|
end
|
73
60
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
# if @authMode
|
79
|
-
# self.extend CipherAuthMode
|
80
|
-
# @logger.debug "Extending auth mode"
|
81
|
-
|
82
|
-
# @auth_data = block.call(:auth_data)
|
83
|
-
# @auth_tag = block.call(:auth_tag)
|
84
|
-
# end
|
85
|
-
|
86
|
-
# @iv = block.call(:iv)
|
87
|
-
# @ivLength = block.call(:ivLength) || 16 if @iv.nil?
|
88
|
-
|
89
|
-
# @key = block.call(:key)
|
90
|
-
# @keysize = block.call(:keysize) if @key.nil?
|
91
|
-
|
92
|
-
# @padding = block.call(:padding)
|
93
|
-
|
94
|
-
# @cipherOps = block.call(:cipherOps)
|
95
|
-
|
96
|
-
# @plaintext_length = 0
|
97
|
-
# @ciphertext_length = 0
|
98
|
-
|
99
|
-
# @min_input_length = opts[:min_input_length] || -1
|
100
|
-
|
101
|
-
#end
|
102
|
-
|
61
|
+
end
|
62
|
+
|
63
|
+
def iv_required?
|
64
|
+
@iv_required
|
103
65
|
end
|
104
66
|
|
105
67
|
def has_iv?
|
@@ -107,15 +69,19 @@ module Ccrypto
|
|
107
69
|
end
|
108
70
|
|
109
71
|
def has_key?
|
110
|
-
not_empty?(@
|
72
|
+
not_empty?(@ccrypto_key)
|
111
73
|
end
|
112
74
|
|
113
75
|
def has_min_input_length?
|
114
76
|
not_empty?(@min_input_length) and @min_input_length.to_i > -1
|
115
77
|
end
|
116
78
|
|
117
|
-
def has_fixed_auth_tag_length?
|
118
|
-
|
79
|
+
#def has_fixed_auth_tag_length?
|
80
|
+
# not_empty?(@fixed_auth_tag_length) and @fixed_auth_tag_length.to_i > -1
|
81
|
+
#end
|
82
|
+
|
83
|
+
def has_mandatory_block_size?
|
84
|
+
not_empty?(@mandatory_block_size) and @mandatory_block_size.to_i > -1
|
119
85
|
end
|
120
86
|
|
121
87
|
def is_auth_mode_cipher?
|
@@ -149,57 +115,34 @@ module Ccrypto
|
|
149
115
|
def encrypt_cipher_mode
|
150
116
|
@cipherOps = :encrypt
|
151
117
|
end
|
118
|
+
alias_method :set_encrypt_mode, :encrypt_cipher_mode
|
152
119
|
def is_encrypt_cipher_mode?
|
153
|
-
|
154
|
-
when :encrypt, :enc
|
155
|
-
true
|
156
|
-
else
|
157
|
-
false
|
158
|
-
end
|
120
|
+
@cipherOps == :encrypt
|
159
121
|
end
|
160
122
|
|
161
123
|
def decrypt_cipher_mode
|
162
124
|
@cipherOps = :decrypt
|
163
125
|
end
|
126
|
+
alias_method :set_decrypt_mode, :decrypt_cipher_mode
|
164
127
|
def is_decrypt_cipher_mode?
|
165
|
-
|
166
|
-
when :decrypt, :dec
|
167
|
-
true
|
168
|
-
else
|
169
|
-
false
|
170
|
-
end
|
128
|
+
@cipherOps == :decrypt
|
171
129
|
end
|
172
130
|
|
173
131
|
def to_s
|
174
132
|
res = [@algo, @keysize, @mode, @padding].reject { |v| is_empty?(v) }.join("-")
|
175
|
-
"#{res} (#{@authMode})"
|
176
|
-
|
133
|
+
"#{res} (Auth mode? : #{@authMode})"
|
134
|
+
end
|
135
|
+
|
136
|
+
# enable sort
|
137
|
+
def <=>(val)
|
138
|
+
@algo <=> val.algo
|
177
139
|
end
|
178
140
|
|
141
|
+
private
|
179
142
|
def logger
|
180
|
-
|
181
|
-
@logger = Tlogger.new
|
182
|
-
@logger.tag = :cipher_conf
|
183
|
-
end
|
184
|
-
@logger
|
143
|
+
Ccrypto.logger(:cipher_conf)
|
185
144
|
end
|
186
|
-
end
|
187
145
|
|
188
|
-
|
189
|
-
# # str can be String or Hash
|
190
|
-
# # If String it will be directly used by underlying
|
191
|
-
# # engine with minimum parsing which means might not have other
|
192
|
-
# # info
|
193
|
-
# def initialize(str)
|
194
|
-
# raise CipherConfigException, "Hash is expected" if not str.is_a?(Hash)
|
195
|
-
# super(str[:algo], str)
|
196
|
-
# end
|
197
|
-
|
198
|
-
#end
|
199
|
-
|
200
|
-
#class CipherEngineConfig < CipherConfig
|
201
|
-
# # engine that is discovered by cipher engine
|
202
|
-
# # Means can directly use the object
|
203
|
-
#end
|
146
|
+
end
|
204
147
|
|
205
148
|
end
|
@@ -5,94 +5,105 @@ module Ccrypto
|
|
5
5
|
include AlgoConfig
|
6
6
|
include TR::CondUtils
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
attr_reader :algo, :outBitLength, :outByteLength
|
9
|
+
attr_reader :fixed_input_len_byte
|
10
|
+
# variable allow provider to put things related to the provider e.g. JCE provider etc
|
11
|
+
attr_accessor :provider_config
|
11
12
|
def initialize(algo, outBitLen, opts = { })
|
12
13
|
@algo = algo
|
13
14
|
@outBitLength = outBitLen
|
15
|
+
@outByteLength = @outBitLength/8
|
16
|
+
|
14
17
|
if not_empty?(opts)
|
15
18
|
@provider_config = opts[:provider_config]
|
16
|
-
@
|
19
|
+
@fixed_input_len_byte = opts[:fixed_input_len_byte] || -1
|
20
|
+
else
|
21
|
+
@provider_config = {}
|
22
|
+
@fixed_input_len_byte = -1
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
|
-
def
|
21
|
-
|
26
|
+
def has_fixed_input_len_byte?
|
27
|
+
@fixed_input_len_byte != -1
|
22
28
|
end
|
29
|
+
|
30
|
+
#def to_s
|
31
|
+
# "Digest #{algo}"
|
32
|
+
#end
|
33
|
+
|
23
34
|
end
|
24
35
|
|
25
|
-
SHA1 = DigestConfig.new(:sha1, 160)
|
26
|
-
SHA224 = DigestConfig.new(:sha224, 224)
|
27
|
-
SHA256 = DigestConfig.new(:sha256, 256)
|
28
|
-
SHA384 = DigestConfig.new(:sha384, 384)
|
29
|
-
SHA512 = DigestConfig.new(:sha512, 512)
|
30
|
-
SHA512_224 = DigestConfig.new(:sha512_224, 224)
|
31
|
-
SHA512_256 = DigestConfig.new(:sha512_256, 256)
|
32
|
-
|
33
|
-
SHA3_224 = DigestConfig.new(:sha3_224, 224)
|
34
|
-
SHA3_256 = DigestConfig.new(:sha3_256, 256)
|
35
|
-
SHA3_384 = DigestConfig.new(:sha3_384, 384)
|
36
|
-
SHA3_512 = DigestConfig.new(:sha3_512, 512)
|
37
|
-
|
38
|
-
BLAKE2b160 = DigestConfig.new(:blake2b160, 160)
|
39
|
-
BLAKE2b256 = DigestConfig.new(:blake2b256, 256)
|
40
|
-
BLAKE2b384 = DigestConfig.new(:blake2b384, 384)
|
41
|
-
BLAKE2b512 = DigestConfig.new(:blake2b512, 512)
|
42
|
-
|
43
|
-
BLAKE2s128 = DigestConfig.new(:blake2s128, 128)
|
44
|
-
BLAKE2s160 = DigestConfig.new(:blake2s160, 160)
|
45
|
-
BLAKE2s224 = DigestConfig.new(:blake2s224, 224)
|
46
|
-
BLAKE2s256 = DigestConfig.new(:blake2s256, 256)
|
47
|
-
|
48
|
-
DSTU7564_256 = DigestConfig.new(:dstu7564_256, 256)
|
49
|
-
KUPYNA_256 = DSTU7564_256
|
50
|
-
DSTU7564_384 = DigestConfig.new(:dstu7564_384, 384)
|
51
|
-
KUPYNA_384 = DSTU7564_384
|
52
|
-
DSTU7564_512 = DigestConfig.new(:dstu7564_512, 512)
|
53
|
-
KUPYNA_512 = DSTU7564_512
|
54
|
-
|
55
|
-
GOSH3411 = DigestConfig.new(:gosh3411, 256)
|
56
|
-
GOSH3411_2012_256 = DigestConfig.new(:gosh3411_2012_256, 256)
|
57
|
-
GOSH3411_2012_512 = DigestConfig.new(:gosh3411_2012_512, 512)
|
58
|
-
|
59
|
-
HARAKA256 = DigestConfig.new(:haraka256, 256, { hard_in_bit_length: 256 })
|
60
|
-
HARAKA512 = DigestConfig.new(:haraka512, 256, { hard_in_bit_length: 512 })
|
61
|
-
|
62
|
-
KECCAK224 = DigestConfig.new(:keccak224, 224)
|
63
|
-
KECCAK256 = DigestConfig.new(:keccak256, 256)
|
64
|
-
KECCAK288 = DigestConfig.new(:keccak288, 288)
|
65
|
-
KECCAK384 = DigestConfig.new(:keccak384, 384)
|
66
|
-
KECCAK512 = DigestConfig.new(:keccak512, 512)
|
67
|
-
|
68
|
-
RIPEMD128 = DigestConfig.new(:ripemd128, 128)
|
69
|
-
RIPEMD160 = DigestConfig.new(:ripemd160, 160)
|
70
|
-
RIPEMD256 = DigestConfig.new(:ripemd256, 256)
|
71
|
-
RIPEMD320 = DigestConfig.new(:ripemd320, 320)
|
72
|
-
|
73
|
-
SHAKE128_256 = DigestConfig.new(:shake128_256, 256)
|
74
|
-
SHAKE256_512 = DigestConfig.new(:shake256_512, 512)
|
75
|
-
SHAKE128 = DigestConfig.new(:shake128, 128)
|
76
|
-
SHAKE256 = DigestConfig.new(:shake256, 256)
|
77
|
-
|
78
|
-
SKEIN1024_1024 = DigestConfig.new(:skein1024_1024, 1024)
|
79
|
-
SKEIN1024_384 = DigestConfig.new(:skein1024_384, 384)
|
80
|
-
SKEIN1024_512 = DigestConfig.new(:skein1024_512, 512)
|
81
|
-
|
82
|
-
SKEIN256_128 = DigestConfig.new(:skein256_128, 128)
|
83
|
-
SKEIN256_160 = DigestConfig.new(:skein256_160, 160)
|
84
|
-
SKEIN256_224 = DigestConfig.new(:skein256_224, 224)
|
85
|
-
SKEIN256_256 = DigestConfig.new(:skein256_256, 256)
|
86
|
-
|
87
|
-
SKEIN512_128 = DigestConfig.new(:skein512_128, 128)
|
88
|
-
SKEIN512_160 = DigestConfig.new(:skein512_160, 160)
|
89
|
-
SKEIN512_224 = DigestConfig.new(:skein512_224, 224)
|
90
|
-
SKEIN512_256 = DigestConfig.new(:skein512_256, 256)
|
91
|
-
SKEIN512_384 = DigestConfig.new(:skein512_384, 384)
|
92
|
-
SKEIN512_512 = DigestConfig.new(:skein512_512, 512)
|
93
|
-
|
94
|
-
SM3 = DigestConfig.new(:sm3, 256)
|
95
|
-
|
96
|
-
WHIRLPOOL = DigestConfig.new(:whirlpool, 512)
|
36
|
+
#SHA1 = DigestConfig.new(:sha1, 160)
|
37
|
+
#SHA224 = DigestConfig.new(:sha224, 224)
|
38
|
+
#SHA256 = DigestConfig.new(:sha256, 256)
|
39
|
+
#SHA384 = DigestConfig.new(:sha384, 384)
|
40
|
+
#SHA512 = DigestConfig.new(:sha512, 512)
|
41
|
+
#SHA512_224 = DigestConfig.new(:sha512_224, 224)
|
42
|
+
#SHA512_256 = DigestConfig.new(:sha512_256, 256)
|
43
|
+
|
44
|
+
#SHA3_224 = DigestConfig.new(:sha3_224, 224)
|
45
|
+
#SHA3_256 = DigestConfig.new(:sha3_256, 256)
|
46
|
+
#SHA3_384 = DigestConfig.new(:sha3_384, 384)
|
47
|
+
#SHA3_512 = DigestConfig.new(:sha3_512, 512)
|
48
|
+
|
49
|
+
#BLAKE2b160 = DigestConfig.new(:blake2b160, 160)
|
50
|
+
#BLAKE2b256 = DigestConfig.new(:blake2b256, 256)
|
51
|
+
#BLAKE2b384 = DigestConfig.new(:blake2b384, 384)
|
52
|
+
#BLAKE2b512 = DigestConfig.new(:blake2b512, 512)
|
53
|
+
|
54
|
+
#BLAKE2s128 = DigestConfig.new(:blake2s128, 128)
|
55
|
+
#BLAKE2s160 = DigestConfig.new(:blake2s160, 160)
|
56
|
+
#BLAKE2s224 = DigestConfig.new(:blake2s224, 224)
|
57
|
+
#BLAKE2s256 = DigestConfig.new(:blake2s256, 256)
|
58
|
+
|
59
|
+
#DSTU7564_256 = DigestConfig.new(:dstu7564_256, 256)
|
60
|
+
#KUPYNA_256 = DSTU7564_256
|
61
|
+
#DSTU7564_384 = DigestConfig.new(:dstu7564_384, 384)
|
62
|
+
#KUPYNA_384 = DSTU7564_384
|
63
|
+
#DSTU7564_512 = DigestConfig.new(:dstu7564_512, 512)
|
64
|
+
#KUPYNA_512 = DSTU7564_512
|
65
|
+
|
66
|
+
#GOSH3411 = DigestConfig.new(:gosh3411, 256)
|
67
|
+
#GOSH3411_2012_256 = DigestConfig.new(:gosh3411_2012_256, 256)
|
68
|
+
#GOSH3411_2012_512 = DigestConfig.new(:gosh3411_2012_512, 512)
|
69
|
+
|
70
|
+
#HARAKA256 = DigestConfig.new(:haraka256, 256, { hard_in_bit_length: 256 })
|
71
|
+
#HARAKA512 = DigestConfig.new(:haraka512, 256, { hard_in_bit_length: 512 })
|
72
|
+
|
73
|
+
#KECCAK224 = DigestConfig.new(:keccak224, 224)
|
74
|
+
#KECCAK256 = DigestConfig.new(:keccak256, 256)
|
75
|
+
#KECCAK288 = DigestConfig.new(:keccak288, 288)
|
76
|
+
#KECCAK384 = DigestConfig.new(:keccak384, 384)
|
77
|
+
#KECCAK512 = DigestConfig.new(:keccak512, 512)
|
78
|
+
|
79
|
+
#RIPEMD128 = DigestConfig.new(:ripemd128, 128)
|
80
|
+
#RIPEMD160 = DigestConfig.new(:ripemd160, 160)
|
81
|
+
#RIPEMD256 = DigestConfig.new(:ripemd256, 256)
|
82
|
+
#RIPEMD320 = DigestConfig.new(:ripemd320, 320)
|
83
|
+
|
84
|
+
#SHAKE128_256 = DigestConfig.new(:shake128_256, 256)
|
85
|
+
#SHAKE256_512 = DigestConfig.new(:shake256_512, 512)
|
86
|
+
#SHAKE128 = DigestConfig.new(:shake128, 128)
|
87
|
+
#SHAKE256 = DigestConfig.new(:shake256, 256)
|
88
|
+
|
89
|
+
#SKEIN1024_1024 = DigestConfig.new(:skein1024_1024, 1024)
|
90
|
+
#SKEIN1024_384 = DigestConfig.new(:skein1024_384, 384)
|
91
|
+
#SKEIN1024_512 = DigestConfig.new(:skein1024_512, 512)
|
92
|
+
#
|
93
|
+
#SKEIN256_128 = DigestConfig.new(:skein256_128, 128)
|
94
|
+
#SKEIN256_160 = DigestConfig.new(:skein256_160, 160)
|
95
|
+
#SKEIN256_224 = DigestConfig.new(:skein256_224, 224)
|
96
|
+
#SKEIN256_256 = DigestConfig.new(:skein256_256, 256)
|
97
|
+
|
98
|
+
#SKEIN512_128 = DigestConfig.new(:skein512_128, 128)
|
99
|
+
#SKEIN512_160 = DigestConfig.new(:skein512_160, 160)
|
100
|
+
#SKEIN512_224 = DigestConfig.new(:skein512_224, 224)
|
101
|
+
#SKEIN512_256 = DigestConfig.new(:skein512_256, 256)
|
102
|
+
#SKEIN512_384 = DigestConfig.new(:skein512_384, 384)
|
103
|
+
#SKEIN512_512 = DigestConfig.new(:skein512_512, 512)
|
104
|
+
|
105
|
+
#SM3 = DigestConfig.new(:sm3, 256)
|
106
|
+
|
107
|
+
#WHIRLPOOL = DigestConfig.new(:whirlpool, 512)
|
97
108
|
|
98
109
|
end
|
@@ -4,10 +4,15 @@ module Ccrypto
|
|
4
4
|
class HMACConfig
|
5
5
|
include AlgoConfig
|
6
6
|
|
7
|
-
attr_accessor :
|
7
|
+
attr_accessor :ccrypto_key
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
attr_reader :digest_config
|
10
|
+
|
11
|
+
attr_accessor :provider_config
|
12
|
+
|
13
|
+
def initialize(digestConfig)
|
14
|
+
@digest_config = digestConfig
|
11
15
|
end
|
16
|
+
|
12
17
|
end
|
13
18
|
end
|