Class/Module Index [+]

Quicksearch

Origami::Encryption

Module to provide support for encrypting and decrypting PDF documents.

Public Class Methods

rand_bytes(n) click to toggle source

Generates n random bytes from a fast PRNG.

# File lib/origami/encryption.rb, line 303
def self.rand_bytes(n)
  ::Array.new(n) { rand(256) }.pack("C*")
end
strong_rand_bytes(n) click to toggle source

Generates n random bytes from a crypto PRNG.

# File lib/origami/encryption.rb, line 310
def self.strong_rand_bytes(n)
  if Origami::OPTIONS[:use_openssl]
    OpenSSL::Random.random_bytes(n)
  elsif RUBY_VERSION >= '1.9'
    Random.new.bytes(n)
  else
    self.rand_bytes(n)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.