openssl

OpenSSL "Seal" in C (or via shell)

I'm working on porting some PHP code to C, that contacts a web API. The issue I've come across is that the PHP code uses the function openssl_seal(), but I can't seem to find any way to do the same thing in C or even via openssl in a call to system(). From the PHP manual on openssl_seal(): int openssl_seal ( string $data , str...

HOW to use OpenSSL in C to send email (via gmail) using SMPTS (TLS)

Writing in C/C++ (not COM C#) As a follow on from these questions: http://www.developerweb.net/forum/showthread.php?t=3477 http://stackoverflow.com/questions/440762/openssl-command-line-troubles http://stackoverflow.com/questions/1246742/how-to-translate-openssl-sclient-starttls-smtp-command-to-c-code http://stackoverflow.com/questio...

What is a socket library?

While reading about OpenSSL I've stumbled upon sentence: "It would be nice if security was as simple as linking in a different socket library when building a program". What is this mentioned socket library? What is it used for (i.e. in Java or C#)? ...

ezcrypto not encrypting consistently in JRuby (MRI is fine)

I'm trying to encrypt some data using the Ezcrypto gem in Ruby. Things work perfectly when running under MRI, but I'm getting strange results when running the same code using JRuby. Executing the following should produce the same output with repeated called. Output from MRI: irb(main):007:0> Base64.encode64(EzCrypto::Key.encrypt_with_...

Load RSA keys from files

Hello, I used openSSL command to create 2 files: 1 for RSA public key & 1 for RSA private key. How do I recover RSA keys using C? Specifically, I have these functions: RSA_public_encrypt(read_num, in_buf, out_buf, public_key, RSA_PKCS1_PADDING); RSA_private_decrypt(read_num, in_buf, out_buf, private_key, RSA_PKCS1_PADDING); The 4th ...

How do I get SSL working in fsockopen?

I'm running PHP 5.2.6 on Windows, I have extension=php_curl.dll and extension=php_openssl.dll uncommented in php.ini; as such I can see the following in phpinfo: curl cURL support enabled cURL Information libcurl/7.16.0 OpenSSL/0.9.8g zlib/1.2.3 openssl OpenSSL support enabled OpenSSL Version OpenSSL 0.9.8g 19 Oct 200...

C OpenSSL block size

My code: EVP_DecryptInit (&ctx, EVP_des_cbc (), key, iv); if (EVP_DecryptUpdate (&ctx, outbuf, &olen, inbuff, in_length) != 1) { fprintf (stderr, "error in decrypt update\n"); return -1; } if (EVP_DecryptFinal (&ctx, outbuf + olen, &tlen) != 1) { fprintf (stderr, "error in decrypt final\n"); r...

Php paypalewp on windows not working right, short return

I am working on a payment script using paypalewp, it seems to work fine in the stage environment which is a centos linux box, however on my dev box it doesn't... when I run the button creation script on my local machine (windows vista ultimate) the button generated code looks like this -----BEGIN PKCS7----- MIIBhwYJKoZIhvcNAQcDoIIBeDC...

Reading Private Key in PEM format with LockBox

I have to digitally sign a string using the SHA-1 algorithm with RSA using PKCS#1 padding. I have downloaded Turbo Power Lockbox. The private key I have is in PEM format and was created using openssl: openssl req -x509 -nodes -days 365 -newkey rsa:1024 -sha1 -subj "/C=US/ST=CA/L=Mountain View/CN=www.mycompany.com" -keyout myrsake...

Visual Studio merging DLL into console application

OK I'm getting desperate here so please I really need some help if anyone could be so kind. It must be a really simple thing but I am absolutely confused still how to fix this problem. I have very simple program to simplify things as shown below... #include <openssl/evp.h> int main (int argc, char *argv[]) { EVP_CIPHER_CTX ctx; ...

Access violation writing location

I have the following code: #include <openssl/bn.h> #include <openssl/rsa.h> unsigned char* key; RSA* rsa = RSA_new(); rsa = RSA_generate_key(1024,65537,NULL,NULL); //init pubkey key[BN_num_bytes(rsa->n)] = '\0'; BN_bn2bin(rsa->n, key); printf("RSA Pub: %s\n", key); RSA_free( rsa ); rsa = NULL; The debugger is telling me that I have a...

SSL wrapper stream in C

I have a simple stream_t type in C with your basic read/write operations, and support for multiple underlying implementations using function pointers. So a stream could be backed by a file, a char buffer, etc. One stream type is a standard POSIX socket, and I would like to code a wrapper stream that will add SSL support to an existing s...

Getting the result of OPENSSL SHA1() function into an ARRAY

Hey, i'm working on a project and i have some problems.I have searched but can not find any satisfied answer. i have a huge file consists of 0 and 1s. i'm getting 1024 (my chunk) bits into an array chunk and after that i apply SHA1() function which is implemented in openssl/sha.h library. char chunk[1024]; while((fgets(chunk,1024...

How to make Ruby AES-256-CBC and PHP MCRYPT_RIJNDAEL_128 play well together

I'm generating data to send from a Ruby stack to a PHP stack. I'm using the OpenSSL::Cipher library on the Ruby side and the 'mcrypt' library in PHP. When I encrypt using 'aes-256-cbc' (256-bit block size) in Ruby I need to use MCRYPT_RIJNDAEL_128 (128-bit block size) in PHP to decrypt it. I suspect the Ruby code that is broken, becau...

Part II: How to make Ruby AES-256-CBC and PHP MCRYPT_RIJNDAEL_128 play well together

This question is a continuation of my last one, regarding How to make Ruby AES-256-CBC and PHP MCRYPT_RIJNDAEL_128 play well together. I've got that working now, but I'm still struggling to go the other direction. The PHP generated cryptogram appears to have all the information that was provided, but I cannot get the Ruby code to decry...

INDY 10.1.5 - Which SSL dlls work?

I'm trying to connect to google documents (following Marco Cantu's excellent REST example) but I am getting the following SSL errors: 1) If I use the SSL dlls from openssl-0.9.8i-i386-win32.zip I get the error: "Could not load SSL library" 2) If I use the SSL dlls from indy_OpenSSL096m.zip I get the error: "Error connecting with SSL"...

Bind a client's local IP through SSL

Hi, I'm looking to add SSL support to a client application written in C/C++ that I'm developing (it is multi-platform, designed to work on Linux and Windows). OpenSSL documentation is pretty poor, but I found a good working tutorial here. To my knowledge, however, there is no way to bind the socket to a local IP address using the BIO ha...

What is good practice regarding use of RAND_load_file and RAND_write_file

When using openssl I've been taught to use RAND_load_file and RAND_write_file to ensure the library uses good entropy at all times. However if RAND_load_file fails because the file does not exist I need to get get entropy from some other place. Let's assume I use /dev/random or /dev/urandom to do this. Is it good practice to use RAND_wri...

Trouble using GSoap and SSL

I'm writing a gSoap client application against a service that has both standard http and https versions. Everything I've written so far works fine with the http service, but when I switch over to the https service, suddenly I'm getting errors. The only change I made to the code for https support was to add the following on startup: s...

C++ openssl for digitally signing data

I would like to use OpenSSL in C++ to digitally verify signed data. Here is what I want to do: use the openssl command line to sign a file, with my private key. send the data to the program the program will verify the signature (public key stored internally), and will check if it's correct Also I would like to add ablity to encrypt/...