pki_express 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +2 -2
  3. data/.github/workflows/test.yml +22 -0
  4. data/.gitignore +27 -27
  5. data/.rspec +1 -0
  6. data/CHANGELOG.md +19 -12
  7. data/Gemfile +9 -4
  8. data/README.md +24 -24
  9. data/Rakefile +7 -1
  10. data/lib/pki_express/auth_complete_result.rb +21 -21
  11. data/lib/pki_express/auth_start_result.rb +76 -76
  12. data/lib/pki_express/authentication.rb +284 -284
  13. data/lib/pki_express/base_signer.rb +54 -54
  14. data/lib/pki_express/cades_signature.rb +89 -89
  15. data/lib/pki_express/cades_signature_starter.rb +242 -242
  16. data/lib/pki_express/check_service_result.rb +15 -15
  17. data/lib/pki_express/command_error.rb +13 -13
  18. data/lib/pki_express/commands.rb +24 -24
  19. data/lib/pki_express/digest_algorithm.rb +118 -118
  20. data/lib/pki_express/digest_algorithm_and_value.rb +30 -30
  21. data/lib/pki_express/discovery_service_result.rb +25 -25
  22. data/lib/pki_express/enum.rb +9 -9
  23. data/lib/pki_express/error_codes.rb +46 -46
  24. data/lib/pki_express/installation_not_found_error.rb +8 -8
  25. data/lib/pki_express/name.rb +47 -47
  26. data/lib/pki_express/oids.rb +30 -30
  27. data/lib/pki_express/pades_certification_level.rb +7 -7
  28. data/lib/pki_express/pades_horizontal_align.rb +9 -9
  29. data/lib/pki_express/pades_measurement_units.rb +8 -8
  30. data/lib/pki_express/pades_page_optimization.rb +50 -50
  31. data/lib/pki_express/pades_page_orientation.rb +9 -9
  32. data/lib/pki_express/pades_paper_size.rb +21 -21
  33. data/lib/pki_express/pades_signature.rb +16 -16
  34. data/lib/pki_express/pades_signature_explorer.rb +30 -30
  35. data/lib/pki_express/pades_signature_starter.rb +251 -251
  36. data/lib/pki_express/pades_signer.rb +274 -274
  37. data/lib/pki_express/pades_signer_info.rb +9 -9
  38. data/lib/pki_express/pades_size.rb +17 -17
  39. data/lib/pki_express/pades_text_horizontal_align.rb +8 -8
  40. data/lib/pki_express/pades_vertical_align.rb +9 -9
  41. data/lib/pki_express/pades_visual_auto_positioning.rb +21 -21
  42. data/lib/pki_express/pades_visual_image.rb +51 -51
  43. data/lib/pki_express/pades_visual_manual_positioning.rb +16 -16
  44. data/lib/pki_express/pades_visual_positioning.rb +27 -27
  45. data/lib/pki_express/pades_visual_rectangle.rb +74 -74
  46. data/lib/pki_express/pades_visual_representation.rb +22 -22
  47. data/lib/pki_express/pades_visual_text.rb +35 -35
  48. data/lib/pki_express/pk_algorithms.rb +157 -157
  49. data/lib/pki_express/pk_certificate.rb +61 -61
  50. data/lib/pki_express/pki_brazil_certificate_fields.rb +57 -57
  51. data/lib/pki_express/pki_brazil_certificate_types.rb +19 -19
  52. data/lib/pki_express/pki_express_config.rb +39 -26
  53. data/lib/pki_express/pki_express_operator.rb +240 -234
  54. data/lib/pki_express/pki_italy_certificate_fields.rb +15 -15
  55. data/lib/pki_express/pki_italy_certificate_types.rb +11 -11
  56. data/lib/pki_express/signature_algorithm_and_value.rb +34 -34
  57. data/lib/pki_express/signature_explorer.rb +74 -74
  58. data/lib/pki_express/signature_finisher.rb +314 -314
  59. data/lib/pki_express/signature_policy_identifier.rb +20 -20
  60. data/lib/pki_express/signature_start_result.rb +12 -12
  61. data/lib/pki_express/signature_starter.rb +116 -116
  62. data/lib/pki_express/signer.rb +151 -151
  63. data/lib/pki_express/standard_signature_policies.rb +58 -58
  64. data/lib/pki_express/timestamp_authority.rb +50 -50
  65. data/lib/pki_express/trust_service_auth_parameters.rb +20 -20
  66. data/lib/pki_express/trust_service_info.rb +37 -37
  67. data/lib/pki_express/trust_service_manager.rb +258 -258
  68. data/lib/pki_express/trust_service_session_result.rb +29 -29
  69. data/lib/pki_express/trust_service_session_types.rb +7 -7
  70. data/lib/pki_express/tsa_authentication_type.rb +14 -14
  71. data/lib/pki_express/validation_error.rb +8 -8
  72. data/lib/pki_express/validation_item.rb +43 -43
  73. data/lib/pki_express/validation_item_types.rb +103 -103
  74. data/lib/pki_express/validation_results.rb +120 -120
  75. data/lib/pki_express/version.rb +3 -3
  76. data/lib/pki_express/version_manager.rb +20 -20
  77. data/lib/pki_express.rb +69 -69
  78. data/pki_express.gemspec +26 -26
  79. data/spec/pki_express/pki_express_config_spec.rb +73 -0
  80. data/spec/pki_express/pki_express_operator_spec.rb +31 -0
  81. data/spec/spec_helper.rb +13 -0
  82. metadata +17 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96112f72042a8deaa33c44615735b0cf1583cbf8ff3d9f2063a9c34fae618de6
4
- data.tar.gz: 7f154465e01e5159bce9ab4ff6548fcf74564fdb7cc8b57dec8e88958966e1aa
3
+ metadata.gz: 0d86c8e5e27501e0d6b4190e3ef39a4924a15a9c2df9beeca64e6471d126af4a
4
+ data.tar.gz: d456aa97640505edf6e022ce259e106667f955a48e5847645f61051441578bef
5
5
  SHA512:
6
- metadata.gz: 80afd152f8767046e2a6a0314a3d05ca4d94039be98a19d14e2b56d8dc2bbdae8ed6485e4fede075a59311a33635665766a64539f423c4023e64bbf6db6da5fa
7
- data.tar.gz: 5b4fdc45bea0e0b534b46f291121702d0bca002ed579eb01c10c8836def784ed086f499d9a74c2939c34ab20fe9e134536b0e39359afb26cfd630fcce52c555f
6
+ metadata.gz: 9b9455b5679a94dbae4be8e77c0370b787733e6914fd0fb4ed13395d4c3135ca3bc7673e049f12ce6e3a4310f4066216f0028fe4cd8873711e2f149ed0a3a290
7
+ data.tar.gz: 3645a5bab0674fc5ca7e9e4f43d04358b3ed3fa274dae30e8ecbd3fc94854f071550447d6e6a168fb102784de22101c34128ddf5bb08a6b0fd608141032b5275
data/.gitattributes CHANGED
@@ -1,3 +1,3 @@
1
-
2
- # Enable automatic line ending normalization
1
+
2
+ # Enable automatic line ending normalization
3
3
  * text=auto
@@ -0,0 +1,22 @@
1
+ name: Ruby
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ matrix:
11
+ ruby-version: ['3.1', '2.7']
12
+
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - name: Set up Ruby ${{ matrix.ruby-version }}
16
+ uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
17
+ with:
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ - name: Install dependencies
20
+ run: bundle install
21
+ - name: Run tests
22
+ run: bundle exec rake spec
data/.gitignore CHANGED
@@ -1,28 +1,28 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
15
- *.gem
16
- *.rbc
17
- .DS_Store
18
- .bundle
19
- .rvmrc
20
- .ruby-version
21
- .yardoc
22
- .rake_tasks~
23
- Gemfile.lock
24
- coverage/*
25
- doc/*
26
- log/*
27
- pkg/*
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *.gem
16
+ *.rbc
17
+ .DS_Store
18
+ .bundle
19
+ .rvmrc
20
+ .ruby-version
21
+ .yardoc
22
+ .rake_tasks~
23
+ Gemfile.lock
24
+ coverage/*
25
+ doc/*
26
+ log/*
27
+ pkg/*
28
28
  .idea/*
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/CHANGELOG.md CHANGED
@@ -1,12 +1,19 @@
1
- ## 1.3.0 (2021-08-04)
2
- * Adds culture and time zone attributes to PkiExpressOperator
3
-
4
- ## 1.2.0 (2021-01-25)
5
- * Adds PAdES Explorer
6
-
7
- ## 1.1.0 (2020-09-09)
8
- * Adds PAdES Signer
9
- * Adds support for Trust Services Management
10
-
11
- ## 1.0.0 (2018-04-11)
12
- * First publicly available version
1
+ ## 1.3.2 (2023-03-30)
2
+ * Improve valdiation of PkiExpressConfig's contructor parameters
3
+
4
+ ## 1.3.1 (2023-03-30)
5
+ * Fix pki express operator finalizer
6
+ * Improve pathname call with exists
7
+
8
+ ## 1.3.0 (2021-08-04)
9
+ * Adds culture and time zone attributes to PkiExpressOperator
10
+
11
+ ## 1.2.0 (2021-01-25)
12
+ * Adds PAdES Explorer
13
+
14
+ ## 1.1.0 (2020-09-09)
15
+ * Adds PAdES Signer
16
+ * Adds support for Trust Services Management
17
+
18
+ ## 1.0.0 (2018-04-11)
19
+ * First publicly available version
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify the gem's dependencies in pki_express.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify the gem's dependencies in pki_express.gemspec
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'rspec', '~> 3.12'
8
+ gem 'faker', '~> 3.1', '>= 3.1.1'
9
+ end
data/README.md CHANGED
@@ -1,24 +1,24 @@
1
- PKI Express for Ruby
2
- ============================
3
- [![Gem Version](https://badge.fury.io/rb/rest_pki.svg)](https://badge.fury.io/rb/rest_pki)
4
-
5
- This library contains classes that encapsulate the calls to PKI Express.
6
-
7
- The recommended way to install **PKI Expresss lib** is through setting in your Gemfile:
8
-
9
- ````ruby
10
- gem 'pki_express', '~> 1.3.0'
11
- ````
12
-
13
- And with installing via [Bundler](http://bundler.io/) on your project root folder:
14
-
15
- bundle install
16
-
17
- Alternatively, You can install this gem globally by executing the following command:
18
-
19
- gem install pki_express
20
-
21
- Samples
22
- -------
23
- Please visit the [PKI Suite samples repository](https://github.com/LacunaSoftware/PkiSuiteSamples/tree/master/Ruby)
24
- for examples on how to use this library.
1
+ PKI Express for Ruby
2
+ ============================
3
+ [![Gem Version](https://badge.fury.io/rb/pki_express.svg)](https://badge.fury.io/rb/pki_express)
4
+
5
+ This library contains classes that encapsulate the calls to PKI Express.
6
+
7
+ The recommended way to install **PKI Expresss lib** is through setting in your Gemfile:
8
+
9
+ ````ruby
10
+ gem 'pki_express', '~> 1.3.2'
11
+ ````
12
+
13
+ And with installing via [Bundler](http://bundler.io/) on your project root folder:
14
+
15
+ bundle install
16
+
17
+ Alternatively, You can install this gem globally by executing the following command:
18
+
19
+ gem install pki_express
20
+
21
+ Samples
22
+ -------
23
+ Please visit the [PKI Suite samples repository](https://github.com/LacunaSoftware/PkiSuiteSamples/tree/master/Ruby)
24
+ for examples on how to use this library.
data/Rakefile CHANGED
@@ -1 +1,7 @@
1
- require 'bundler/gem_tasks'
1
+ require 'rake'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |t|
6
+ t.pattern = Dir.glob('spec/**/*_spec.rb')
7
+ end
@@ -1,22 +1,22 @@
1
- module PkiExpress
2
- class AuthCompleteResult
3
-
4
- attr_accessor :certificate, :validation_results
5
-
6
- def initialize(model)
7
- @certificate = nil
8
- @validation_results = nil
9
-
10
- if model
11
- certificate = model.fetch(:certificate)
12
- if certificate
13
- @certificate = PKCertificate.new(certificate)
14
- end
15
- validation_results = model.fetch(:validationResults)
16
- if validation_results
17
- @validation_results = ValidationResults.new(validation_results)
18
- end
19
- end
20
- end
21
- end
1
+ module PkiExpress
2
+ class AuthCompleteResult
3
+
4
+ attr_accessor :certificate, :validation_results
5
+
6
+ def initialize(model)
7
+ @certificate = nil
8
+ @validation_results = nil
9
+
10
+ if model
11
+ certificate = model.fetch(:certificate)
12
+ if certificate
13
+ @certificate = PKCertificate.new(certificate)
14
+ end
15
+ validation_results = model.fetch(:validationResults)
16
+ if validation_results
17
+ @validation_results = ValidationResults.new(validation_results)
18
+ end
19
+ end
20
+ end
21
+ end
22
22
  end
@@ -1,77 +1,77 @@
1
- module PkiExpress
2
- class AuthStartResult
3
- attr_accessor :digest_algorithm_name, :digest_algorithm_oid
4
-
5
- def initialize(model)
6
- @nonce_base64 = nil
7
- @digest_algorithm_name = nil
8
- @digest_algorithm_oid = nil
9
-
10
- if model
11
- @nonce_base64 = model.fetch(:toSignData)
12
- @digest_algorithm_name = model.fetch(:digestAlgorithmName)
13
- @digest_algorithm_oid = model.fetch(:digestAlgorithmOid)
14
- end
15
- end
16
-
17
- # region The "nonce" accessors
18
-
19
- def nonce
20
- _get_nonce
21
- end
22
-
23
- def _get_nonce
24
- unless @nonce_base64
25
- return nil
26
- end
27
-
28
- Base64.decode64(@nonce_base64)
29
- end
30
- private :_get_nonce
31
-
32
- def nonce=(nonce)
33
- _set_nonce(nonce)
34
- end
35
-
36
- def _set_nonce(nonce)
37
- unless nonce
38
- raise 'The provided "nonce" is not valid'
39
- end
40
-
41
- begin
42
- b64 = Base64.encode64(nonce)
43
- rescue Error
44
- raise 'The provided "nonce" is not valid.'
45
- end
46
-
47
- @nonce_base64 = b64
48
- end
49
- private :_set_nonce
50
-
51
- def nonce_base64
52
- _get_nonce_base64
53
- end
54
-
55
- def _get_nonce_base64
56
- @nonce_base64
57
- end
58
- private :_get_nonce_base64
59
-
60
- def nonce_base64=(nonce_base64)
61
- unless nonce_base64
62
- raise 'The provided "nonce_base64" is not valid'
63
- end
64
-
65
- begin
66
- Base64.decode64(nonce_base64)
67
- rescue Error
68
- raise 'The provided "nonce_base64" is not Base64-encoded.'
69
- end
70
-
71
- @nonce_base64 = nonce_base64
72
- end
73
-
74
- #endregion
75
-
76
- end
1
+ module PkiExpress
2
+ class AuthStartResult
3
+ attr_accessor :digest_algorithm_name, :digest_algorithm_oid
4
+
5
+ def initialize(model)
6
+ @nonce_base64 = nil
7
+ @digest_algorithm_name = nil
8
+ @digest_algorithm_oid = nil
9
+
10
+ if model
11
+ @nonce_base64 = model.fetch(:toSignData)
12
+ @digest_algorithm_name = model.fetch(:digestAlgorithmName)
13
+ @digest_algorithm_oid = model.fetch(:digestAlgorithmOid)
14
+ end
15
+ end
16
+
17
+ # region The "nonce" accessors
18
+
19
+ def nonce
20
+ _get_nonce
21
+ end
22
+
23
+ def _get_nonce
24
+ unless @nonce_base64
25
+ return nil
26
+ end
27
+
28
+ Base64.decode64(@nonce_base64)
29
+ end
30
+ private :_get_nonce
31
+
32
+ def nonce=(nonce)
33
+ _set_nonce(nonce)
34
+ end
35
+
36
+ def _set_nonce(nonce)
37
+ unless nonce
38
+ raise 'The provided "nonce" is not valid'
39
+ end
40
+
41
+ begin
42
+ b64 = Base64.encode64(nonce)
43
+ rescue Error
44
+ raise 'The provided "nonce" is not valid.'
45
+ end
46
+
47
+ @nonce_base64 = b64
48
+ end
49
+ private :_set_nonce
50
+
51
+ def nonce_base64
52
+ _get_nonce_base64
53
+ end
54
+
55
+ def _get_nonce_base64
56
+ @nonce_base64
57
+ end
58
+ private :_get_nonce_base64
59
+
60
+ def nonce_base64=(nonce_base64)
61
+ unless nonce_base64
62
+ raise 'The provided "nonce_base64" is not valid'
63
+ end
64
+
65
+ begin
66
+ Base64.decode64(nonce_base64)
67
+ rescue Error
68
+ raise 'The provided "nonce_base64" is not Base64-encoded.'
69
+ end
70
+
71
+ @nonce_base64 = nonce_base64
72
+ end
73
+
74
+ #endregion
75
+
76
+ end
77
77
  end