Method: Kennedy::Ticket#to_encrypted

Defined in:
lib/kennedy/ticket.rb

#to_encryptedString

Generates an encrypted chunk of JSON with the identifier and expiration time for this ticket encoded in

Returns:

  • (String)

    An encrypted JSON string



60
61
62
63
64
65
66
67
68
# File 'lib/kennedy/ticket.rb', line 60

def to_encrypted
  cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
  cipher.encrypt
  cipher.key = @passphrase
  cipher.iv = @iv
  encrypted = cipher.update(to_expiring_json)
  encrypted << cipher.final
  encrypted
end