openssl

using openssl in c++

I used the openssl command line program to generate some keys and to sign some data. I'm now trying to use a c++ program that will verify the signing of these files with the public key. I know about the EVP_VerifyInit function and a few others, but I'm not sure how the EVP_PKEY object works and also, can I just read in the data files cre...

How do I make Ruby read .cer public ssl key?

Hey, I am working on a RoR website that requires an e-payment module. The e-payment implementation requires that the xml data is encoded using a public ssl key provided by them. What I tried to do in Ruby: public_key = OpenSSL::PKey::RSA.new(File.read(public_key_file)) If I just try to open the file separately it works fine. But the...

AES equivalent in Ruby openssl?

Gibberish library provides a nice CBC algo... // In Jascascript GibberishAES.enc("Made with Gibberish\n", "password"); // Outputs: "U2FsdGVkX1+21O5RB08bavFTq7Yq/gChmXrO3f00tvJaT55A5pPvqw0zFVnHSW1o" # On the command line echo "U2FsdGVkX1+21O5RB08bavFTq7Yq/gChmXrO3f00tvJaT55A5pPvqw0zFVnHSW1o" | openssl enc -d -aes-256-cbc -a -k passw...

openssl_random_pseudo_bytes() is slow (PHP)

I'm using opennssl_random_pseudo_bytes() in PHP and it is performing ultra slowly. My application often timeouts (throws that execution time limit error). Is there a particular reason for OpenSSL random to be this slow? I'm using Windows 7 x86 currently on my developer machine. ...

Local installation of ruby / rubygems with no root access

Hi, I have a machine at work from wich I'd like to run a script that gathers some information about other machines. I want to do it in Ruby, since it's what I know best, but I've ran into some problems, all apparently due to the same reason: I don't have root access in this machine. So what I did was: Download ruby source, configure (w...

OpenSSL enabled but not working

I am running Apache 2.2.13 and PHP 5.2.12. Just installed PHP 5.2.12 manually (to have access to all extensions) and enabled OpenSSL. phpinfo() indicates OpenSSL is enabled and running OpenSSL 0.9.8k 25 Mar 2009. I'm getting this error: PHP Fatal error: Call to undefined function ftp_ssl_connect(). I've seen where the PHP manual sugges...

using libcrypto to copy hash to character array

I'm following the example of code available in: http://www.openssl.org/docs/crypto/sha.html# After the following: EVP_DigestFinal_ex(&mdctx, md_value, &md_len); the final digest is stored in md_value. I'd like to copy that digest to another character array of equal size. This is a two part problem though. I'm not understanding what e...

How to check whether decrypting was successful?

When using blowfish algorithm from openssl library, one can encrypt and decrypt any data. Furthermore any data can be encrypted (decrypted) with any key\iv. There is no way in openssl to tell whether decryption was successful or not. It's just some mathematical transformation. So, what should I do to be sure that encryption was success...

Reading from an SSL Socket in Twisted

I'm trying to implement an SSL client in Twisted that simply must connect to a socket and read binary data (specifically, tuples of data). I've gotten the code to a point where it seems to connect and disconnect successfully but no data is ever read from the socket. class FeedbackHandler(LineReceiver): MAX_LENGTH = 1024*1024 def c...

What's the difference between openssl_pkcs12_export() and openssl_x509_export() PHP functions?

This is probably a stupid question, but as far as I can tell there's not much difference aside the additional parameters in pkcs12 version. ...

Digital signature verification with OpenSSL

How can I verify CMS/PKCS #7 messages using OpenSSL in Ruby? PKCS #7 message is used as a digital signature for user messages, so I need to sign a new user message and verify the incoming one. I haven't found anything helpfull in documentation and google. I have found few code samples for signing, but nothing for verifying: signed = Ope...

Can you help me get my head around openssl public key encryption with rsa.h in c++?

Hi there, I am trying to get my head around public key encryption using the openssl implementation of rsa in C++. Can you help? So far these are my thoughts (please do correct if necessary) Alice is connected to Bob over a network Alice and Bob want secure communications Alice generates a public / private key pair and sends public key...

Is there any OpenSSL function to convert PKCS7 file to PEM

Hi, Is there any openssl api function to convert PKCS7 file to PEM. I am able to convert a PKCS12 file to PEM using PKCS12_parse() function which returns key and certificate given the password. There is no similar function for pkcs7. My pkcs7 input has just the certificate in binary format. I am able to do the conversion using command ...

SSL_CTX_use_PrivateKey_file fail under Linux

I'm trying to use the SSL_CTX_use_PrivateKey_file function in OpenSSL under Linux, but it returns false. The surrounding code has been ported from Windows, where everything runs fine. Is there something that must be done differently depending on system? I've compiled the OpenSSL library myself (default config etc) under Ubuntu and am us...

Troubleshooting compile time link errors

I'm trying to statically link to libcrypto.a (from the openssl library) after building it from source with a new toolchain. However whenever I try to use any of the functions from that library, I keep receiving "undefined reference" errors. I've made sure the right header file was included. I've also double checked the symbol table of li...

DES3 decryption in Ruby on Rails

My RoR server receives a string, that was encrypted in C++ application using des3 with base64 encoding The cipher object is created so: cipher = OpenSSL::Cipher::Cipher::new("des3") cipher.key = key_str cipher.iv = iv_str key_str and iv_str: are string representations of key and initialization vector for encryption algorithm. They a...

How to read key file for use with HMAC_Init_ex()

I generated an RSA private key using openssl. I need to use the HMAC_*() functions of the OpenSSL library in plain C to hash/sign data, but I'm unsure on how to correctly extract the private key data from that file. From what I know, that file is B64 encoded, so I uncoded it and stored it in a buffer. However, it seems to me that the H...

How do you change a user password in a script with busybox and openssl?

I need to synchronize a user account and password to an external source on a system with busybox and openssl installed. When the external source tells my system to update credentials, how do I change the user's password in a script? I will have the password in plain text. This has to be automated, and from what I can tell busybox pass...

openssl BF_cfb64_encrypt thread-safety

Is openssl's BF_cfb64_encrypt() thread safe? A sample code to use it to encrypt / decrypt a blob of data would be much appreciated. ...

Generate password hash in java like openssl passwd -1

Is there an easy way in Java to generate password hashes in same form as generated by "openssl passwd -1". Example: # openssl passwd -1 test $1$Gt24/BL6$E4ZsrluohHFxtcdqCH7jo. I'm looking for a pure java solution that does not call openssl or any other external program. Thanks Raffael ...