This code returns an encrypted private key:
require 'openssl'rsa_key_pair = OpenSSL::PKey::RSA.new(2048)public_key = rsa_key_pair.public_keycipher = OpenSSL::Cipher::AES256.new(:CBC)password = "Password12@"private_key = rsa_key_pair.to_s(cipher, password)
Normally, when you use OpenSSL::Cipher::AES256 you have to provide the algorithm with both a key/password and an initialization vector, but private_key = rsa_key_pair.to_s(cipher, password)
doesn't take an iv as an argument. What does it use as the iv, and/or what method can I use to decrypt the private key?