hola a todos tengo dificultades para utilizar una librería PHP para encriptar y una biblioteca de rubí on rails para descifrar o alguien tiene alguna otra mejor forma de realizarlo.
RUBI ON RAILS
Código Rubi on rails:
Ver originalrequire 'openssl'
file_path_key = "data.bin1"
file_path_key_ = "wrapped.bin1"
private_key_file = "private.key";
wrapped = File.read(file_path_key_)
cipher_text = File.read(file_path_key)
privkey = OpenSSL::PKey::RSA.new(File.read(private_key_file))
#p privkey
key = privkey.private_decrypt(wrapped)
#p privkey.private_decrypt(Base64.decode64(File.read(file_path_key_)))
#p key
cipher = OpenSSL::Cipher.new('rc4')
cipher.decrypt
cipher.key = key
p cipher.update(cipher_text)
Código PHP:
Ver original
$message = 'hello,world';
$cipher_text = "hi";
$keys = NULL;
$file = fopen('wrapped.bin1', 'wb');
$file = fopen('data.bin1', 'wb');