module JWA::Cipher

Helper to get OpenSSL cipher instance from a string.

Public Class Methods

for(cipher_name) click to toggle source

Ruby raises RuntimeError jRuby raises OpenSSL::Cipher::CipherError Also jRuby is sligthly more relaxed on cipher names, returning something even for aes-999-cbc, I don't know what it is and how it works.

# File lib/jwa/cipher.rb, line 10
def for(cipher_name)
  OpenSSL::Cipher.new(cipher_name)
rescue RuntimeError, OpenSSL::Cipher::CipherError
  raise NotImplementedError, "The OpenSSL library provided by this Ruby version does not support #{cipher_name}."
end