class MessageVerifier::KeyGenerator

Overview

KeyGenerator is a simple wrapper around OpenSSL's implementation of PBKDF2. It can be used to derive a number of keys for various purposes from a given secret. This lets Rails applications have a single secure secret, but avoid reusing that key in multiple incompatible contexts.

Defined in:

message_verifier/key_generator.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(secret, iterations : Int32 = 2 ** 16) #

[View source]

Instance Method Detail

def generate_key(salt, key_size = 64) #

Returns a derived key suitable for use. The default key_size is chosen to be compatible with the default settings of ActiveSupport::MessageVerifier. i.e. OpenSSL::Digest::SHA1#block_length


[View source]