ccrypto 0.1.2 → 0.2.0

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: 0d9b4e9adddf9cbf8aca58067b846446828debe3ccb6bf628d22c710bfd21c90
4
- data.tar.gz: b18db1468580e01942f76a5774a799f8041406ea8a97a0baabe1680d08782673
3
+ metadata.gz: 9be6eb61015364e145f1607c28f3001a73c84c08fb0e31a1acdc50fd5fc343a3
4
+ data.tar.gz: cf2b5b56fca36ce1edc1dedc49979170d362676a9ced1db2cffeb16f8cd6e49a
5
5
  SHA512:
6
- metadata.gz: 6b155d2377681522df9e5ff54996dda2a545b890b6cbb854552d52d8f7e31d7e219399cb5fd053cfe70622616b8d32fcc9e7c2a6b436602cf055df1a71281bc9
7
- data.tar.gz: e4941b14400b7ef909095299a6f2c0e89fb931c5057c3b0d70b2eb6952f48bb7cb8b535594bc1c71c6e74de60b70281bc37047c3a45ffe9f6c1a602184fa6ff7
6
+ metadata.gz: b8bd46f24aa6bd03e7d303681d4013e416f16faf181d63dd4ea61cf0b14f897be029f0badbea9169fc156dfea07df65863661135009fc5b25c312af0b9d73777
7
+ data.tar.gz: 56d3a26f498225721ead8d36a6fee0e875e660840a7eda072087941d2ed583548c16a1d8acfe71563f5bd9bba834e484cc52db5400230c369f23a8c632e8367b
data/.release_history.yml CHANGED
@@ -4,3 +4,7 @@ ccrypto:
4
4
  :timestamp: 1660209199.3682408
5
5
  - :version: 0.1.1
6
6
  :timestamp: 1678162760.4304333
7
+ - :version: 0.1.2
8
+ :timestamp: 1680181385.6366327
9
+ - :version: 0.1.3
10
+ :timestamp: 1680413190.0441186
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ AllCops:
2
+ DisabledByDefault: true
data/Gemfile CHANGED
@@ -8,3 +8,5 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
 
10
10
  gem "rspec", "~> 3.0"
11
+
12
+ #gem "binenc", git: "binenc", branch: 'master'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccrypto (0.1.1)
4
+ ccrypto (0.2.0)
5
5
  activesupport
6
6
  teLogger
7
7
  toolrack
@@ -9,55 +9,64 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (7.0.4.3)
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)
17
- base58 (0.2.3)
22
+ base64 (0.2.0)
23
+ bigdecimal (3.1.5)
24
+ bigdecimal (3.1.5-java)
25
+ colorize (1.1.0)
18
26
  concurrent-ruby (1.2.2)
19
- devops_assist (0.3.9)
20
- git_cli
21
- git_cli_prompt
22
- gvcs
23
- teLogger
24
- toolrack
25
- tty-prompt
27
+ connection_pool (2.4.1)
26
28
  diff-lcs (1.5.0)
27
- git_cli (0.11.2)
28
- gvcs
29
+ drb (2.2.0)
30
+ ruby2_keywords
31
+ git_cli (0.13.9)
29
32
  ptools (~> 1.4.0)
30
- teLogger
31
- toolrack
32
- git_cli_prompt (0.3.2)
33
- teLogger
34
- toolrack
35
- tty-prompt
36
- gvcs (0.1.1)
37
- i18n (1.12.0)
33
+ teLogger (> 0.2)
34
+ toolrack (> 0.23)
35
+ i18n (1.14.1)
38
36
  concurrent-ruby (~> 1.0)
39
- minitest (5.18.0)
37
+ minitest (5.20.0)
38
+ mutex_m (0.2.0)
40
39
  pastel (0.8.0)
41
40
  tty-color (~> 0.5)
42
41
  ptools (1.4.3)
43
- rake (13.0.6)
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)
44
51
  rspec (3.12.0)
45
52
  rspec-core (~> 3.12.0)
46
53
  rspec-expectations (~> 3.12.0)
47
54
  rspec-mocks (~> 3.12.0)
48
- rspec-core (3.12.1)
55
+ rspec-core (3.12.2)
49
56
  rspec-support (~> 3.12.0)
50
- rspec-expectations (3.12.2)
57
+ rspec-expectations (3.12.3)
51
58
  diff-lcs (>= 1.2.0, < 2.0)
52
59
  rspec-support (~> 3.12.0)
53
- rspec-mocks (3.12.4)
60
+ rspec-mocks (3.12.6)
54
61
  diff-lcs (>= 1.2.0, < 2.0)
55
62
  rspec-support (~> 3.12.0)
56
- rspec-support (3.12.0)
63
+ rspec-support (3.12.1)
64
+ ruby2_keywords (0.0.5)
57
65
  teLogger (0.2.2)
58
- toolrack (0.20.2)
59
- base58
66
+ toolrack (0.24.1)
60
67
  tty-color (0.6.0)
68
+ tty-command (0.10.1)
69
+ pastel (~> 0.8)
61
70
  tty-cursor (0.7.1)
62
71
  tty-prompt (0.23.1)
63
72
  pastel (~> 0.8)
@@ -66,20 +75,23 @@ GEM
66
75
  tty-cursor (~> 0.7)
67
76
  tty-screen (~> 0.8)
68
77
  wisper (~> 2.0)
69
- tty-screen (0.8.1)
78
+ tty-screen (0.8.2)
70
79
  tzinfo (2.0.6)
71
80
  concurrent-ruby (~> 1.0)
72
81
  wisper (2.0.1)
73
82
 
74
83
  PLATFORMS
75
84
  ruby
85
+ universal-java-1.8
86
+ universal-java-11
87
+ universal-java-17
76
88
  x86_64-linux
77
89
 
78
90
  DEPENDENCIES
79
91
  ccrypto!
80
- devops_assist
81
92
  rake (~> 13.0)
93
+ release-gem
82
94
  rspec (~> 3.0)
83
95
 
84
96
  BUNDLED WITH
85
- 2.2.28
97
+ 2.5.1
data/Rakefile CHANGED
@@ -3,8 +3,7 @@
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
5
 
6
- require 'devops_assist'
7
-
8
6
  RSpec::Core::RakeTask.new(:spec)
9
7
 
10
8
  task default: :spec
9
+ require 'release/gem'
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
- @provider_config = val
16
- self
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
- attr_accessor :algo, :key
14
- attr_accessor :keysize, :mode, :padding
15
- attr_accessor :iv, :ivLength
16
- attr_accessor :cipherOps
9
+ # given later by the provider
10
+ attr_accessor :ccrypto_key, :iv
17
11
 
18
- # required by certain mode such as CCM
19
- attr_accessor :plaintext_length, :ciphertext_length
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,91 +19,73 @@ module Ccrypto
24
19
  attr_reader :min_input_length, :mandatory_block_size
25
20
 
26
21
  # provider specific
27
- attr_accessor :native_config
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
- @mandatory_Block_size = -1
34
+ @mandatory_block_size = -1
35
+ @fixed_iv_length = -1
40
36
 
41
37
  if not_empty?(opts) and opts.is_a?(Hash)
42
38
  @mode = opts[:mode]
43
-
39
+
44
40
  @authMode = opts[:authMode] || false
45
- #if is_mode?(:gcm)
46
- if @authMode
47
- self.extend CipherAuthMode
48
- @logger.debug "Extending auth mode"
49
-
50
- @auth_data = opts[:auth_data]
51
- @auth_tag = opts[:auth_tag]
52
-
53
- end
54
41
 
55
42
  @iv = opts[:iv]
56
43
  @ivLength = opts[:ivLength] if is_empty?(@iv)
57
44
 
58
- @key = opts[:key]
59
- @keysize = opts[:keysize] if is_empty?(@key)
45
+ @iv_required = (@ivLength.nil? ? false : @ivLength.to_i > 0)
60
46
 
61
- @padding = opts[:padding]
47
+ @ccrypto_key = opts[:ccrypto_key]
48
+ @keysize = opts[:keysize] if is_empty?(@ccrypto_key)
62
49
 
63
- @cipherOps = opts[:cipherOps]
50
+ @padding = opts[:padding]
64
51
 
65
52
  @min_input_length = opts[:min_input_length] || -1
66
53
 
67
54
  @mandatory_block_size = opts[:mandatory_block_size] || -1
68
55
 
69
- end
70
-
71
- #if block
72
- # @mode = block.call(:mode)
56
+ #@fixed_auth_tag_length = opts[:fixed_auth_tag_length] || -1
73
57
 
74
- # #if is_mode?(:gcm)
75
- # if @authMode
76
- # self.extend CipherAuthMode
77
- # @logger.debug "Extending auth mode"
78
-
79
- # @auth_data = block.call(:auth_data)
80
- # @auth_tag = block.call(:auth_tag)
81
- # end
82
-
83
- # @iv = block.call(:iv)
84
- # @ivLength = block.call(:ivLength) || 16 if @iv.nil?
85
-
86
- # @key = block.call(:key)
87
- # @keysize = block.call(:keysize) if @key.nil?
88
-
89
- # @padding = block.call(:padding)
90
-
91
- # @cipherOps = block.call(:cipherOps)
92
-
93
- # @plaintext_length = 0
94
- # @ciphertext_length = 0
95
-
96
- # @min_input_length = opts[:min_input_length] || -1
97
-
98
- #end
58
+ @provider_config = opts[:provider_config]
59
+ end
99
60
 
100
61
  end
62
+
63
+ def iv_required?
64
+ @iv_required
65
+ end
101
66
 
102
67
  def has_iv?
103
68
  not_empty?(@iv)
104
69
  end
105
70
 
106
71
  def has_key?
107
- not_empty?(@key)
72
+ not_empty?(@ccrypto_key)
73
+ end
74
+
75
+ def has_min_input_length?
76
+ not_empty?(@min_input_length) and @min_input_length.to_i > -1
77
+ end
78
+
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
108
85
  end
109
86
 
110
87
  def is_auth_mode_cipher?
111
- @authMode
88
+ @authMode == true
112
89
  end
113
90
 
114
91
  def is_algo?(algo)
@@ -123,64 +100,49 @@ module Ccrypto
123
100
  if @mode.nil? or is_empty?(@mode)
124
101
  false
125
102
  else
126
- (@mode.to_s.downcase =~ /#{mode.to_s}/) != nil
103
+ (@mode.to_s.downcase =~ /#{mode.to_s.downcase}/) != nil
127
104
  end
128
105
  end
129
106
 
107
+ def needs_plaintext_length?
108
+ is_mode?(:ccm)
109
+ end
110
+
111
+ def needs_ciphertext_length?
112
+ is_mode?(:ccm)
113
+ end
114
+
130
115
  def encrypt_cipher_mode
131
116
  @cipherOps = :encrypt
132
117
  end
118
+ alias_method :set_encrypt_mode, :encrypt_cipher_mode
133
119
  def is_encrypt_cipher_mode?
134
- case @cipherOps
135
- when :encrypt, :enc
136
- true
137
- else
138
- false
139
- end
120
+ @cipherOps == :encrypt
140
121
  end
141
122
 
142
123
  def decrypt_cipher_mode
143
124
  @cipherOps = :decrypt
144
125
  end
126
+ alias_method :set_decrypt_mode, :decrypt_cipher_mode
145
127
  def is_decrypt_cipher_mode?
146
- case @cipherOps
147
- when :decrypt, :dec
148
- true
149
- else
150
- false
151
- end
128
+ @cipherOps == :decrypt
152
129
  end
153
130
 
154
131
  def to_s
155
132
  res = [@algo, @keysize, @mode, @padding].reject { |v| is_empty?(v) }.join("-")
156
- "#{res} (#{@authMode})"
157
- #"#{@algo}-#{@keysize}-#{@mode}-#{@padding}"
133
+ "#{res} (Auth mode? : #{@authMode})"
158
134
  end
159
135
 
136
+ # enable sort
137
+ def <=>(val)
138
+ @algo <=> val.algo
139
+ end
140
+
141
+ private
160
142
  def logger
161
- if @logger.nil?
162
- @logger = Tlogger.new
163
- @logger.tag = :cipher_conf
164
- end
165
- @logger
143
+ Ccrypto.logger(:cipher_conf)
166
144
  end
167
- end
168
145
 
169
- #class DirectCipherConfig < CipherConfig
170
- # # str can be String or Hash
171
- # # If String it will be directly used by underlying
172
- # # engine with minimum parsing which means might not have other
173
- # # info
174
- # def initialize(str)
175
- # raise CipherConfigException, "Hash is expected" if not str.is_a?(Hash)
176
- # super(str[:algo], str)
177
- # end
178
-
179
- #end
180
-
181
- #class CipherEngineConfig < CipherConfig
182
- # # engine that is discovered by cipher engine
183
- # # Means can directly use the object
184
- #end
146
+ end
185
147
 
186
148
  end
@@ -5,94 +5,105 @@ module Ccrypto
5
5
  include AlgoConfig
6
6
  include TR::CondUtils
7
7
 
8
- attr_accessor :algo, :outBitLength
9
- attr_accessor :hardInBitLength
10
- attr_accessor :nativeDigestEngine
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
- @hardInBitLength = opts[:hard_in_bit_length]
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 has_hard_in_bit_length?
21
- (not @hardInBitLength.nil?) or @hardInBitLength.to_i > 0
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 :key, :digest
7
+ attr_accessor :ccrypto_key
8
8
 
9
- def initialize
10
- @digest = :sha256
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