Class: PkiExpress::PadesSignatureStarter
- Inherits:
-
SignatureStarter
- Object
- PkiExpressOperator
- BaseSigner
- SignatureStarter
- PkiExpress::PadesSignatureStarter
- Defined in:
- lib/pki_express/pades_signature_starter.rb
Instance Attribute Summary collapse
-
#certification_level ⇒ Object
Returns the value of attribute certification_level.
-
#custom_signature_field_name ⇒ Object
Returns the value of attribute custom_signature_field_name.
-
#suppress_default_visual_representation ⇒ Object
Returns the value of attribute suppress_default_visual_representation.
Attributes inherited from PkiExpressOperator
#offline, #signature_policy, #timestamp_authority, #trust_lacuna_test_root
Instance Method Summary collapse
-
#initialize(config = PkiExpressConfig.new) ⇒ PadesSignatureStarter
constructor
A new instance of PadesSignatureStarter.
-
#pdf_to_sign ⇒ Object
region The “pdf_to_sign” accessors.
- #pdf_to_sign=(content_raw) ⇒ Object
- #pdf_to_sign_base64 ⇒ Object
- #pdf_to_sign_base64=(content_base64) ⇒ Object
- #pdf_to_sign_path ⇒ Object
- #pdf_to_sign_path=(path) ⇒ Object
-
#start ⇒ Object
endregion.
- #visual_representation ⇒ Object
- #visual_representation=(vr) ⇒ Object
-
#visual_representation_content_raw ⇒ Object
region set_visual_representation.
- #visual_representation_content_raw=(content_raw) ⇒ Object
- #visual_representation_path ⇒ Object
- #visual_representation_path=(path) ⇒ Object
Methods inherited from SignatureStarter
#certificate, #certificate=, #certificate_base64, #certificate_base64=, #certificate_path, #certificate_path=, get_result
Methods inherited from PkiExpressOperator
#add_file_reference, #add_trusted_root, finalize
Constructor Details
#initialize(config = PkiExpressConfig.new) ⇒ PadesSignatureStarter
Returns a new instance of PadesSignatureStarter.
6 7 8 9 10 11 12 13 |
# File 'lib/pki_express/pades_signature_starter.rb', line 6 def initialize(config=PkiExpressConfig.new) super(config) @pdf_to_sign_path = nil @vr_json_path = nil @suppress_default_visual_representation = false @custom_signature_field_name = nil @certification_level = nil end |
Instance Attribute Details
#certification_level ⇒ Object
Returns the value of attribute certification_level.
4 5 6 |
# File 'lib/pki_express/pades_signature_starter.rb', line 4 def certification_level @certification_level end |
#custom_signature_field_name ⇒ Object
Returns the value of attribute custom_signature_field_name.
4 5 6 |
# File 'lib/pki_express/pades_signature_starter.rb', line 4 def custom_signature_field_name @custom_signature_field_name end |
#suppress_default_visual_representation ⇒ Object
Returns the value of attribute suppress_default_visual_representation.
3 4 5 |
# File 'lib/pki_express/pades_signature_starter.rb', line 3 def suppress_default_visual_representation @suppress_default_visual_representation end |
Instance Method Details
#pdf_to_sign ⇒ Object
region The “pdf_to_sign” accessors
17 18 19 |
# File 'lib/pki_express/pades_signature_starter.rb', line 17 def pdf_to_sign _get_pdf_to_sign end |
#pdf_to_sign=(content_raw) ⇒ Object
30 31 32 |
# File 'lib/pki_express/pades_signature_starter.rb', line 30 def pdf_to_sign=(content_raw) _set_pdf_to_sign(content_raw) end |
#pdf_to_sign_base64 ⇒ Object
47 48 49 |
# File 'lib/pki_express/pades_signature_starter.rb', line 47 def pdf_to_sign_base64 _get_pdf_to_sign_base64 end |
#pdf_to_sign_base64=(content_base64) ⇒ Object
61 62 63 |
# File 'lib/pki_express/pades_signature_starter.rb', line 61 def pdf_to_sign_base64=(content_base64) _set_pdf_to_sign_base64(content_base64) end |
#pdf_to_sign_path ⇒ Object
80 81 82 |
# File 'lib/pki_express/pades_signature_starter.rb', line 80 def pdf_to_sign_path _get_pdf_to_sign_path end |
#pdf_to_sign_path=(path) ⇒ Object
89 90 91 |
# File 'lib/pki_express/pades_signature_starter.rb', line 89 def pdf_to_sign_path=(path) _set_pdf_to_sign_path(path) end |
#start ⇒ Object
endregion
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/pki_express/pades_signature_starter.rb', line 193 def start unless @pdf_to_sign_path raise 'The PDF to be signed was not set' end unless @certificate_path raise 'The certificate was not set' end # Generate transfer file. transfer_file_id = get_transfer_filename args = [ @pdf_to_sign_path, @certificate_path, File.(transfer_file_id, @config.transfer_data_folder), ] # Verify and add common options between signers. (args) if @vr_json_path args.append('--visual-rep') args.append(@vr_json_path) end if @custom_signature_field_name args.append('--custom-signature-field-name') args.append(@custom_signature_field_name) # This option can only be used on versions greater than 1.15.0 of the # PKI Express. @version_manager.require_version('1.15') end if @certification_level args.append('--certification-level') args.append(@certification_level) # This option can only be used on versions greater than 1.16.0 of the # PKI Express. @version_manager.require_version('1.16') end if @suppress_default_visual_representation args.append('--suppress-default-visual-rep') # This option can only be used on versions greater than 1.13.1 of the # PKI Express. @version_manager.require_version('1.13.1') end # Invoke command. result = invoke(Commands::START_PADES, args) # Parse output and return model. model = parse_output(result) SignatureStartResult.new(model, transfer_file_id) end |
#visual_representation ⇒ Object
162 163 164 |
# File 'lib/pki_express/pades_signature_starter.rb', line 162 def visual_representation _get_visual_representation end |
#visual_representation=(vr) ⇒ Object
177 178 179 |
# File 'lib/pki_express/pades_signature_starter.rb', line 177 def visual_representation=(vr) _set_visual_representation(vr) end |
#visual_representation_content_raw ⇒ Object
region set_visual_representation
108 109 110 |
# File 'lib/pki_express/pades_signature_starter.rb', line 108 def visual_representation_content_raw _get_visual_representation_content_raw end |
#visual_representation_content_raw=(content_raw) ⇒ Object
121 122 123 |
# File 'lib/pki_express/pades_signature_starter.rb', line 121 def visual_representation_content_raw=(content_raw) _set_visual_representation_content_raw(content_raw) end |
#visual_representation_path ⇒ Object
138 139 140 |
# File 'lib/pki_express/pades_signature_starter.rb', line 138 def visual_representation_path _get_visual_representation_path end |
#visual_representation_path=(path) ⇒ Object
147 148 149 |
# File 'lib/pki_express/pades_signature_starter.rb', line 147 def visual_representation_path=(path) _set_visual_representation_path(path) end |