Re: RSA encryption/decryption with OpenSSL.

2013-08-22 Thread Dave Thompson
> From: owner-openssl-us...@openssl.org On Behalf Of mycompuser > Sent: Wednesday, 21 August, 2013 01:35 > Thanks for the reply. > I do have access to the server code but cannot change it's > implementation to > suite my requirement as the server is serving other clients in other > platforms as

RE: Re: RSA encryption/decryption with OpenSSL.

2013-08-21 Thread mycompuser
Hi Dave, Thanks for the reply. I do have access to the server code but cannot change it's implementation to suite my requirement as the server is serving other clients in other platforms as well. Below is the java code to encrypt an AES symmetric key with the public key it recieves from the clie

Re: RSA encryption/decryption with OpenSSL.

2013-08-21 Thread mycompuser
Hi, Thanks for the reply. "That's because it's not a raw public key; it's a base64 encoded structure containing the key parts. It's a lot more than just stripping the header and footer." I was not aware of this. But I think my requirement is to send the public key in Base64 encoded structur

RE: Re: RSA encryption/decryption with OpenSSL.

2013-08-20 Thread Dave Thompson
> From: owner-openssl-us...@openssl.org On Behalf Of Ken Goldman > Sent: Tuesday, 20 August, 2013 08:08 > On 8/19/2013 3:15 PM, mycompuser wrote: > > But the only > > problem that I currently face is that the key pair > generated by OpenSSL has > > headers and footers of the form -BEGIN RSA P

Re: RSA encryption/decryption with OpenSSL.

2013-08-20 Thread Ken Goldman
On 8/19/2013 3:15 PM, mycompuser wrote: But the only problem that I currently face is that the key pair generated by OpenSSL has headers and footers of the form -BEGIN RSA PUBLIC KEY- -END RSA PUBLIC KEY- for public key likewise there is similar header and footer for private key a

RE: RSA encryption and Decryption code in C language

2013-07-02 Thread yamini
Hello Enrico, Thanks for the code! It really helped. Regards, yamini. -- View this message in context: http://openssl.6102.n7.nabble.com/RSA-encryption-and-Decryption-code-in-C-language-tp45588p45759.html Sent from the OpenSSL - User mailing list archive at Nabble.com. ___

Re: RSA encryption and Decryption code in C language

2013-06-18 Thread Ken Goldman
You cannot generate a private key from a public key. Typically, the receiver generates the key pair and sends the public key to the sender. The sender encrypts with the public key. The receiver decrypts with the private key. A typical format for sending a public key across a channel is an X

Re: RSA encryption and Decryption code in C language

2013-06-18 Thread Hemayamini Kurra
Hello Michel, Thanks for the link. I have the following code. int main() { RSA *key; unsigned char input_ptext[] = "58FD6F1C310FC9D0194FB8B0E99070A6CBA3473BFE69F953E60E99070A6CBA3473BFE69F953E0E99070A6CBA3473BFE69F953E0E99070A6CBAE"; unsigned char ctext[256]; unsigned char ptext[256];

RE: RSA encryption and Decryption code in C language

2013-06-18 Thread enrico d'urso
Hi, I'm implementing a software very similar to yours. This is a small function that I used to generate private and public key: #include int main() { char * file_pem = "key_priv"; char * file_pem_pub = "key_pub"; FILE * fp; int bits = 1024; unsigned long exp = RSA_F4; RS

Re: RSA encryption and Decryption code in C language

2013-06-18 Thread Matt Caswell
On 18 June 2013 09:43, Michel wrote: > Hi Yamini, > > I would suggest looking at the 'EVP Envelope' API : > https://www.openssl.org/docs/crypto/EVP_SealInit.html > Also see: http://wiki.openssl.org/index.php/EVP_Asymmetric_Encryption_and_Decryption_of_an_Envelope Matt __

Re: RSA encryption and Decryption code in C language

2013-06-18 Thread Michel
Hi Yamini, I would suggest looking at the 'EVP Envelope' API : https://www.openssl.org/docs/crypto/EVP_SealInit.html Le 17/06/2013 19:26, yamini a écrit : Hello, I am implementing the DES algorithm between my client and server systems for encryption. The DES key is transmitted in encrypted fo

Re: RSA encryption and decryption performance difference between pkcs11 engine and default engine on windows and solaris

2007-02-14 Thread AD D
durgaprasad jammula, thank you for your help, I do think T2000 (sun sparc machine) has the hardware accelerator for RSA encryption, but I also test the performance on an amd64 machine (dell optiplex 745, a desktop pc), I think there should not be hardware accelerator in the dell amd64 machine, but

Re: RSA encryption and decryption performance difference between pkcs11 engine and default engine on windows and solaris

2007-02-14 Thread durgaprasad jammula
PKCS11 is interface to hardware cryptographic accelators. If you use PKCS11 engine, instead of software doing the encryption/decryption, hardware does it. To use, PKCS11, you need to have cryptographic hardware accelator. This comes by default with Sun Fire T2000. If you encrypt the data with P

Re: RSA encryption

2006-08-03 Thread Marek Marcola
Hello, > Actually this should be the private key. Not the public key. > > RSA_size(prvKey->pkey.rsa) In general - yes, but size of private and public key must be the same for RSA. Best regards, -- Marek Marcola <[EMAIL PROTECTED]> ___

Re: RSA encryption

2006-08-03 Thread Kaushalye Kapuruge
Yeah I rectified it . Sorry I forgot to have u guys posted... :) Actually this should be the private key. Not the public key. RSA_size(prvKey->pkey.rsa) Really appreciate Ur help, Kaushalye Marek Marcola wrote: Hello, Change: strlen((char*)encrypted) to: RSA_size(pubKey->pke

Re: RSA encryption

2006-08-03 Thread Marek Marcola
Hello, Change: strlen((char*)encrypted) to: RSA_size(pubKey->pkey.rsa) Best regards, -- Marek Marcola <[EMAIL PROTECTED]> __ OpenSSL Project http://www.openssl.org User Support Ma

Re: RSA encryption

2006-08-02 Thread Kaushalye Kapuruge
Hi, Yeah it helped. Thanks. Then I wrote this code(attched) to encrypt and decrypt a text. I generated the private key using openssl genrsa -out rsakey2.pem 1024 And then the public key using openssl rsa -in rsakey2.pem -pubout > rsapub2.pem When I compile and run the test the encryption wo

Re: RSA encryption

2006-08-02 Thread Bernhard Froehlich
Kaushalye Kapuruge wrote: Hi, I'm trying to encrypt a Text using a session key and then encrypt that session key using the public key of the reciever side. Can anybody point me to an example in C? For this 1. I need to read the key using PEM format. http://www.openssl.org/docs/crypto/pem.html

Re: RSA encryption and decryption question

2005-12-24 Thread Dr. Stephen Henson
On Sat, Dec 24, 2005, Arsen Hayrapetyan wrote: > When I am passing RSA_size(rsa) as the first argument to > RSA_private_decrypt(), I > am receiving the initial message decoded as "Test messageA". I have > allocated the > RSA_size(rsa) bytes for the buffer receiving the decodod text. Does the > dec

Re: RSA encryption and decryption question

2005-12-24 Thread jimmy
Arsen Hayrapetyan wrote: jimmy wrote: Arsen Hayrapetyan wrote: Hello, I have the following question: unsigned char *plaintext = "Test message"; unsigned char * ciphertext=NULL; RSA *rsa =...; /*here I have an RSA key */ RSA_public_encrypt(strlen(plaintext), plaintext, ciphertext, rsa, RSA

Re: RSA encryption and decryption question

2005-12-24 Thread Arsen Hayrapetyan
jimmy wrote: > Arsen Hayrapetyan wrote: > >> Hello, >> >> I have the following question: >> >> unsigned char *plaintext = "Test message"; >> unsigned char * ciphertext=NULL; >> RSA *rsa =...; /*here I have an RSA key */ >> >> RSA_public_encrypt(strlen(plaintext), plaintext, ciphertext, rsa, >> RS

Re: RSA encryption and decryption question

2005-12-24 Thread 劲吕
The length of ciphertext is not longer than the public key's length. If your public key is 1024bit, the length of ciphertext is 128 bytes. 2005/12/24, jimmy <[EMAIL PROTECTED]>: > Arsen Hayrapetyan wrote: > > Hello, > > > > I have the following question: > > > > unsigned char *plaintext = "Test me

Re: RSA encryption and decryption question

2005-12-24 Thread jimmy
Arsen Hayrapetyan wrote: Hello, I have the following question: unsigned char *plaintext = "Test message"; unsigned char * ciphertext=NULL; RSA *rsa =...; /*here I have an RSA key */ RSA_public_encrypt(strlen(plaintext), plaintext, ciphertext, rsa, RSA_PKCS1_OAEP_PADDIN*G* ); What will be the

Re: RSA encryption/decryption programming

2005-05-10 Thread Sebastian
Sure, take a look at http://www.openssl.org/docs/crypto/crypto.html. Renember to link against libcrypto... Sebastian cranium2003 wrote: hello, I want to write a RSA encryption decryption program in C that encrypt data on one pc sends that encrypted data to other pc and get it decrypted on th

Re: RSA Encryption/Decryption.

2005-05-09 Thread Layla
Thank you :)Sebastian <[EMAIL PROTECTED]> wrote: Hmm,take a look at routines like RSA_new() to create RSA structures. As you coded 'sizeof apub', this will return the size of a _pointer_ - assuming a 32-bit architecture you will get round about four bytes ;-).See: http://www.openssl.org/docs/crypto

Re: RSA Encryption/Decryption.

2005-05-09 Thread Sebastian
Hmm, take a look at routines like RSA_new() to create RSA structures. As you coded 'sizeof apub', this will return the size of a _pointer_ - assuming a 32-bit architecture you will get round about four bytes ;-). See: http://www.openssl.org/docs/crypto/RSA_new.html The runtime error is caused b

Re: RSA encryption/decryption time confusion (discrepancy?)

2005-03-03 Thread Nils Larsch
Vishwas wrote: Dear SSLites, Please observe the following operations. I do the following:- key1 = RSA_generate_key(n, e1, NULL, NULL); num = RSA_private_encrypt(plen, ptext_ex, ctext, key1, RSA_PKCS1_PADDING); RSA_public_decrypt(num, ctext, ptext, key1, RSA_PKCS1_PADDING); Average encryption time i

Re: RSA encryption - to encrypt a c structure ??

2004-08-06 Thread Tan Eng Ten
First of all, you need to write functions that do serialization and de-serialization of your own C structure. Think about network programming, how do you send a C structure using sockets to a receipient? And having the receipient assemble it back into a C structure? Without such functions, any

Re: RSA encryption - to encrypt a c structure ??

2004-08-03 Thread Jayashree Kanchana
Hi, My structure has 3 unsigned char arrays and I will have to move this encrypted data to other machines too. Following is the structure: typedef struct myStruct { unsigned char id[4]; unsigned char type; unsigned char Data[128]; } ; Can you pleas

Re: RE : RSA encryption - to encrypt a c structure ??

2004-08-03 Thread Michael Sierchio
Charles B Cranston wrote: Casting does not actually change the data, only the way in which it is treated by the program. Casting changes the way data are treated by the compiler. There is no string type in C, the semantics of nul-terminated strings are created in the behavior of certain functions.

RE : RE : RSA encryption - to encrypt a c structure ??

2004-08-03 Thread Marc Gaudichet
_decrypt (sizeof (szEncrypted), szEncrypted, (unsigned char *)&sStruct, &Rsa, RSA_PKCS1_PADDING); } I hope this helps. Marc. > -Message d'origine- > De : Jayashree Kanchana [mailto:[EMAIL PROTECTED] > Envoyé : mardi 3 août 2004 16:43 > À : [EMAIL PROTECTED] >

Re: RE : RSA encryption - to encrypt a c structure ??

2004-08-03 Thread Charles B Cranston
One danger with casting a structure as a string is that zero bytes (which can happen due to "slack bits" in the structure) might be interpreted as an end-of-string that would prematurely terminate the data. If you're going to process binary data, look for an API where you specify both a pointer and

Re: RE : RSA encryption - to encrypt a c structure ??

2004-08-03 Thread Jayashree Kanchana
Hi Marc, I am sorry, I am not sure how I can type cast the structure to string, should I do (char *) ? Once I encrypt I am not sure if the encrypted string has the same structure as the original "structure". Can you please show me the synatx to type cast a structure to string. Thanks, Jayashree

Re: RSA encryption - to encrypt a c structure ??

2004-08-03 Thread Steven Bade
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jayashree Kanchana wrote: | Hi, | | I am hoping that someone might have come across this problem and will be | able to help me. | | I am trying to use openssl to encrypt a "c structure" instead of just a | "string", is there any function in openssl that

RE : RSA encryption - to encrypt a c structure ??

2004-08-03 Thread Marc Gaudichet
Maybe you could cast the contents of your structure to a string, encrypt this string and then cast the string back to your structure type. Marc. > -Message d'origine- > De : Jayashree Kanchana [mailto:[EMAIL PROTECTED] > Envoyé : mardi 3 août 2004 16:00 > À : [EMAIL PROTECTED] > Objet :

Re: RSA Encryption

2003-11-03 Thread Andrew Mann
The maximum amount of data you can encrypt with a 1024 bit RSA key is 1024 bits of data = 128 bytes. I think PKCS1 padding adds at least 10 bytes before encoding (I might be off on this number?). You want to use padding if you're concerned about the security of your data (pretty much you wan