[openssl-users] Convert RSA key string to PEM file.

2016-01-01 Thread Sugumar
Hi,

I have a RSA Public key as string type.
I need to convert this string to PEM file. Please help me to create PEM file
from string type.
If u have any sample programs pls post it also for better understanding.



--
View this message in context: 
http://openssl.6102.n7.nabble.com/Convert-RSA-key-string-to-PEM-file-tp61971.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
___
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


[openssl-users] Difference between BIO and Normal openssl functions

2016-01-01 Thread Sugumar
Hi,

I have seen both BIO and normal openssl functions.
Actually what is the difference between both the functions.

Example:
We have PEM_read_BIO_RSAPrivatekey and PEM_read_RSAPrivatekey functions,
What makes these functions different from each other



--
View this message in context: 
http://openssl.6102.n7.nabble.com/Difference-between-BIO-and-Normal-openssl-functions-tp61972.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
___
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] Convert RSA key string to PEM file.

2016-01-01 Thread Sugumar
Ya your example looks good. Thanks.
And i have another method, i have created BIO by passing that key to
BIO_new_mem_buf function then from that BIO i got a RSA structure using
PEM_read_bio_RSAPublicKey function.

Is that will work for me???

Code:

RSA* CreateRSAStruct(void* data, GetKey type)
{
RSA *rsa= NULL;
BIO *rsaKeyBio;
rsaKeyBio = BIO_new_mem_buf(data, -1); //creates read only memory BIO

if (rsaKeyBio==NULL)
{
std::cout<< "Failed to create key BIO" 

[openssl-users] Problem in RSA encrypt and Decrypt using EVP

2016-01-28 Thread Sugumar
Hi,

I have problem in RSA encrypt and decrypt using EVP methods.
My below program is some times working fine and some times it fails to
decrypt the message.
That means when i executing the below code 2 times working fine 3rd time it
fails to decrypt.
Please point out the error.

Code:

#include 
#include 
#include 
#include 
 #include 
 #include 

 EVP_PKEY *pkey = EVP_PKEY_new();
 EVP_PKEY_CTX *ctx2;
 unsigned char *out1;
 size_t outlen1;
 EVP_PKEY_CTX *ctx;
 ENGINE *eng;


RSA *rsakey =RSA_new();


bool GenerateRsaKeyPair()
{
BIGNUM *bnexp = NULL;
unsigned long exp = RSA_F4;
bnexp = BN_new();

if(!BN_set_word(bnexp,exp))
{
std::cout <<"Failed to set exponent word in BIO."

[openssl-users] Problem in decryption using python which cipher text is encrypted in c++

2016-02-19 Thread Sugumar
Hi,

I have encrypted a free text in C++ using a EVP calls with CFB mode and 32
bytes of IV (Hex String).
Then i am passing this cipher text to my another end which is using a
python(PyCrypto library) code to decrypt a cipher text using same Key and
IV.
But i am getting error "IV must be of 16 bytes" in python.
I tried to convert 32 bytes of Hex string to 16 bytes ascii string but
nothing works.

Please help me to resolve this.



--
View this message in context: 
http://openssl.6102.n7.nabble.com/Problem-in-decryption-using-python-which-cipher-text-is-encrypted-in-c-tp63826.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] Problem in decryption using python which cipher text is encrypted in c++

2016-02-21 Thread Sugumar
Thanks for your reply.

Correct me if i am wrong.
What i have understood from your point is, i have to read the first 2 char
of 32 char IV and convert into a byte array right?
For example: my IV "12345678901234567890123456789012"
I have read first 2 char i.e "12" then i have to convert it into byte array.

Please give me some more clear idea about this. 
If u have any example for this please post it for our better understanding.
Thanks.



--
View this message in context: 
http://openssl.6102.n7.nabble.com/Problem-in-decryption-using-python-which-cipher-text-is-encrypted-in-c-tp63826p63868.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


[openssl-users] Need information on AES encryption and decryption Key and IV type

2016-02-26 Thread Sugumar
Hi,,

I am using Openssl for encryption and decryption.
I need some information on AES encryption and decryption key and iv type.
My doubt is when we are using a openssl in command line we need to pass key
and iv as hex strings right?
and same when we are EVP calls in C/C++ programming what is the type of Key
and Iv. i mean it should a hex string or raw binary values?

I saw, openssl command line interface code of openssl in that the hex
strings are converted into hex values.
But in EVP calls the Key and Iv are used directly.





--
View this message in context: 
http://openssl.6102.n7.nabble.com/Need-information-on-AES-encryption-and-decryption-Key-and-IV-type-tp64055.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


[openssl-users] Is SHA hashing algorithm reversable?

2016-04-04 Thread Sugumar
Hi,

I going to use SHA256 algorithm for storing my passwords in secure manner.
But after reading some documentations related to SHA i come to know it is
not reversable. 
Yes hashing means its not reversable only.
But i saw some online websites giving the original data by reversing the
hash data.
is it possible means what is the security of hashing?
I am totally confused pls clarify my doubt.



--
View this message in context: 
http://openssl.6102.n7.nabble.com/Is-SHA-hashing-algorithm-reversable-tp65408.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] Is SHA hashing algorithm reversable?

2016-04-05 Thread Sugumar
Thanks for all the information provided. Really its very nice information.

And one more question, if i am using a salt with the password for computing
a hash value i need to store the salt for future reference and what about
the scenario when attacker gets that salt and hash. That time it may be
reversible right?

Please tell me the correct method to use a salt with password for storing a
passwords in a secure manner.



--
View this message in context: 
http://openssl.6102.n7.nabble.com/Is-SHA-hashing-algorithm-reversable-tp65408p65439.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] Is SHA hashing algorithm reversable?

2016-04-05 Thread Sugumar
Hello,

Ya you are correct James.
But my doubt is what is the best method to hash the password securely with
salt.
I mean which method is preferred by openssl, 

HashValue = Hash(password + salt).
HashValue = Hash( Hash(password) + salt). or something else?
HashValue = Hash(password) + Hash(salt).

or this is up to the user decision?




--
View this message in context: 
http://openssl.6102.n7.nabble.com/Is-SHA-hashing-algorithm-reversable-tp65408p65441.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


[openssl-users] How to make EVP functions returns false

2016-08-09 Thread Sugumar
Hi,
I am using EVP encryption and decryption and rsa key generation api from
openssl for my project.
I need to write unit tests for my code including failure conditions also.
Could you please help me to make below functions returns false without
getting valgrind error.
1. EVP_EncryptInit_ex() & EVP_DecryptInit_ex()
2. EVP_EncryptUpdate() & EVP_DecryptUpdate()
3. EVP_EncryptFinal_ex() & EVP_DecryptFinal_ex()
4. SHA256_Init()
5. SHA256_Update()
6. SHA256_Final()
7. RSA_generate_key_ex()
8. PEM_write_RSAPrivateKey() & PEM_read_RSAPrivateKey
9. PEM_write_RSA_PUBKEY() 
10. PEM_read_bio_RSA_PUBKEY() & PEM_read_bio_RSAPrivateKey



--
View this message in context: 
http://openssl.6102.n7.nabble.com/How-to-make-EVP-functions-returns-false-tp67775.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] How to make EVP functions returns false

2016-08-27 Thread Sugumar
Can any one help me on this? Thanks.



--
View this message in context: 
http://openssl.6102.n7.nabble.com/How-to-make-EVP-functions-returns-false-tp67775p68091.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users