Encrypt from buffer Instead of a file
Hello all! I have created a c file where i encrypt with aes128, and is all good!! I have create a mini-code that do the same that the command: openssl enc -a -aes128 -in file.txt -out file.enc -pass pass:12345678 In my code, i have a file that contents the data and i create a BIO: filename = path_to_file; BIO *in = NULL; in=BIO_new(BIO_s_file()); BIO_read_filename(in,filename); Now I need to change all to create a BIO * from a char [] I have all data that i have to encrypt in a char[9500] (in a buffer) and i don't know how create a BIO from buffer. somebody can help me?? Thank! -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: aes128 code??
Butwhe i type the command 'openssl enc -a -aes128 -in file.txt -out file.enc -pass pass:1234567' i don't specify the ivand in the sample code there is: unsigned char iv[] = {1,2,3,4,5,6,7,8}; EVP_EncryptInit_ex(ctx, EVP_bf_cbc(), NULL, key, iv); I have to do the same that the command do. How can i do this??? Leif Thuresson escribió: Check the EVP_EncryptInit man page. There are some code samples at the end of the page http://www.openssl.org/docs/crypto/EVP_EncryptInit.html# Just replace the cryptos in the sample code with AES128 and adjust the key length and iv length. You can get the key length and iv length from the EVP interface. EVP_CIPHER_key_length(EVP_get_cipherbyname(AES128)) EVP_CIPHER_iv_length(EVP_get_cipherbyname(AES128)) Good luck! /leif Lidia Fernández wrote: Hello all! I have to use aes128 encryption into my program to encrypt a file with a password. To do test, i use a openssl enc -a -aes128 -in file.txt -out file.enc -pass pass:12345678 command. Now i have to find the code into openssl that does this function. I 'm seeing in enc.c class, but it's a bit difficult because there are a lot of code! Somebody has do this sometimes?? Are there some utility for use aes128 into another code more easy?? PD: Sorry for my English...i know that is not good -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
aes128 code??
Hello all! I have to use aes128 encryption into my program to encrypt a file with a password. To do test, i use a openssl enc -a -aes128 -in file.txt -out file.enc -pass pass:12345678 command. Now i have to find the code into openssl that does this function. I 'm seeing in enc.c class, but it's a bit difficult because there are a lot of code! Somebody has do this sometimes?? Are there some utility for use aes128 into another code more easy?? PD: Sorry for my English...i know that is not good -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
aes128 code??
Hello all! I have to use aes128 encryption into my program to encrypt a file with a password. To do test, i use a openssl enc -a -aes128 -in file.txt -out file.enc -pass pass:12345678 command. Now i have to find the code into openssl that does this function. I 'm seeing in enc.c class, but it's a bit difficult because there are a lot of code! Somebody has do this sometimes?? Are there some utility for use aes128 into another code more easy?? PD: Sorry for my English...i know that is not good -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
What Padding does OpenSSL use??
I have to encrypt a file in c with openssl and then i have to decrypt in Java. In Java i use to decrypt the algorithm Cipher cipher = Cipher.getInstance(DES/ECB/PKCS5Padding); With OpenSSL i use openssl enc -a -des-ecb -in file -out file.enc -pass pass:abcdefgh but i have an error message in Java that say javax.crypto.BadPaddingException: Given final block not properly padded What padding does OpenSSL use??? How can i specify the padding?? Thank, Lidia -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
What Padding does OpenSSL use??
I have to encrypt a file in c with openssl and then i have to decrypt in Java. In Java i use to decrypt the algorithm Cipher cipher = Cipher.getInstance(DES/ECB/PKCS5Padding); With OpenSSL i use openssl enc -a -des-ecb -in file -out file.enc -pass pass:abcdefgh but i have an error message in Java that say javax.crypto.BadPaddingException: Given final block not properly padded What padding does OpenSSL use??? How can i specify the padding?? Thank, Lidia -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Openssl encode type...?
Hello all! Thank Julius Davies, the library that you say me is very good. But now i have another problem... When i encrypt in Java, it made a file in UFT-8 format, and this don't understand by openssl enc Do you know how i can change the openssl enc -des3... encode?? i need UFT-8, but i don't know what encode openssl uses. -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: 3des algorithm
Dr. Stephen Henson escribió: On Thu, Nov 08, 2007, Lidia Fernndez wrote: Hello all!! I have an application that interact with Linux and windows. i have to cypher a file in Linux, and windows has to decrypt it. I use openssl and 3des to cypher it. openssl enc -des3 -salt -in file.txt -out 3descifr.txt -pass pass:lidiaCIPHER openssl enc -des-ede3-cbc -d -in 3descifr.txt -out 3desdescifr.txt -pass pass:lidia DECRYPT Do you know if i can decrypt the file with Java?? You need to implement the relevant functionality. That means parsing the file to get the salt and then implemeting EVP_BytesToKey() in Java using the documented algorithm. If i use -k instead of -pass, i think that -k option specify the key in HEX. openssl enc -des3 -salt -in file.txt -out 3descifr.txt -k pass:lidia Then i think that isn't necessary implement the EVP_BytesToKey(), is this all right?? Do you know what is the padding that is used to encrypt it?? Do you know any library in Java that use the 3des algorithm?? Regards! Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED] -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
3des algorithm
Hello all!! I have an application that interact with Linux and windows. i have to cypher a file in Linux, and windows has to decrypt it. I use openssl and 3des to cypher it. openssl enc -des3 -salt -in file.txt -out 3descifr.txt -pass pass:lidiaCIPHER openssl enc -des-ede3-cbc -d -in 3descifr.txt -out 3desdescifr.txt -pass pass:lidia DECRYPT Do you know if i can decrypt the file with Java?? -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Multiples read with ssl
Hello all! I'm working with xsupplicant (Open1x) and i have a problem with SSL. By default, xsupplicant waits a message with 1.000 bytes, but i have modificated this because i need a messages with 10.000 bytes or more. Before: rc=SSL_read(mytls_vars-ssl, out_data,1000); and now, i want to do a loop like... while (rc 0) rc=SSL_read(mytls_vars-ssl, out_data,1000); but this gives a error WANT_TO_READ or WANT_TO_WRITE, i don't know why. Do You can't do multiples read with ssl?? Thank! -- *** LIDIA FERNANDEZ CARPES Departamento de Ingenieria de la Informacion y las Comunicaciones Facultad de Informatica Universidad de Murcia. Campus de Espinardo 30080 Murcia (SPAIN) Tel.: +34 968 364644 Fax: +34 968 364151 email: [EMAIL PROTECTED] *** __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]