Module: Origami::Encryption::EncryptedDocument
- Defined in:
- lib/origami/encryption.rb
Instance Attribute Summary collapse
-
#encryption_dict ⇒ Object
writeonly
Sets the attribute encryption_dict.
-
#encryption_key ⇒ Object
writeonly
Sets the attribute encryption_key.
-
#stm_algo ⇒ Object
writeonly
Sets the attribute stm_algo.
-
#str_algo ⇒ Object
writeonly
Sets the attribute str_algo.
Instance Method Summary collapse
Instance Attribute Details
#encryption_dict=(value) ⇒ Object (writeonly)
Sets the attribute encryption_dict
301 302 303 |
# File 'lib/origami/encryption.rb', line 301 def encryption_dict=(value) @encryption_dict = value end |
#encryption_key=(value) ⇒ Object (writeonly)
Sets the attribute encryption_key
300 301 302 |
# File 'lib/origami/encryption.rb', line 300 def encryption_key=(value) @encryption_key = value end |
#stm_algo=(value) ⇒ Object (writeonly)
Sets the attribute stm_algo
302 303 304 |
# File 'lib/origami/encryption.rb', line 302 def stm_algo=(value) @stm_algo = value end |
#str_algo=(value) ⇒ Object (writeonly)
Sets the attribute str_algo
303 304 305 |
# File 'lib/origami/encryption.rb', line 303 def str_algo=(value) @str_algo = value end |
Instance Method Details
#build(obj, revision, options) ⇒ Object
:nodoc:
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/origami/encryption.rb', line 309 def build(obj, revision, ) #:nodoc: if obj.is_a?(EncryptedObject) # already built if [:decrypt] == true obj.pre_build obj.decrypt! obj.decrypted = false # makes it believe no encryption pass is required obj.post_build end return end if obj.is_a?(ObjectStream) obj.each do |subobj| build(subobj, revision, ) end end obj.pre_build case obj when String if not obj.equal?(@encryption_dict[:U]) and not obj.equal?(@encryption_dict[:O]) and not obj.equal?(@encryption_dict[:UE]) and not obj.equal?(@encryption_dict[:OE]) and not obj.equal?(@encryption_dict[:Perms]) and not (obj.parent.is_a?(Signature::DigitalSignature) and obj.equal?(obj.parent[:Contents])) and not obj.indirect_parent.parent.is_a?(ObjectStream) obj.extend(EncryptedString) obj.decrypted = true obj.encryption_handler = @encryption_dict obj.encryption_key = @encryption_key obj.algorithm = @str_algo end when Stream return if obj.is_a?(XRefStream) return if obj.equal?(self.Catalog.Metadata) and not @encryption_dict.EncryptMetadata obj.extend(EncryptedStream) obj.decrypted = true obj.encryption_handler = @encryption_dict obj.encryption_key = @encryption_key obj.algorithm = @stm_algo when Dictionary, Array obj.map! do |subobj| if subobj.is_indirect? if get_object(subobj.reference) subobj.reference else ref = add_to_revision(subobj, revision) build(subobj, revision, ) ref end else subobj end end obj.each do |subobj| build(subobj, revision, ) end end obj.post_build end |