printing encrypted strings

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

printing encrypted strings

Sheehan, Tim
Hi,
I am trying to store encrypted data into an ascii file.  
The encrypted output appears to be in a binary format.  
Are there SSL functions I should use to convert to an ascii
format before moving it to the file?

thx,
Tim
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: printing encrypted strings

Adam Jones-2
What type of encryption are you using? And what function are you using to
print it out. I have used cout and it works fine with that.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Sheehan, Tim
Sent: Tuesday, September 27, 2005 3:46 PM
To: '[hidden email]'
Subject: printing encrypted strings

Hi,
I am trying to store encrypted data into an ascii file.  
The encrypted output appears to be in a binary format.  
Are there SSL functions I should use to convert to an ascii format before
moving it to the file?

thx,
Tim
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]


Confidentiality Notice:

This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.  If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.  If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: printing encrypted strings

Sheehan, Tim
In reply to this post by Sheehan, Tim
I'm working in C.

I'm actually using the AES 256 algorithm. It has been bolted in
to the SSL like DES(and other enc algs).  The encryption piece
appears to be working well.  I can cipher&decipher without any
issues.  It is when I store that encrypted string to a file.
The file being written is opened with fopen and then fwrite
and fread are used to write & read.  

When I write it out to the file is shows up in a binary format eq.

"\326\34368^H\316f]\234^E\371^C\342\246\217<d=\341?^R\310\237[>3^\:\236\241\
206\243"

Then when I am reading it back, the unique characters are interpreted
incorrectly.
T

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]On Behalf Of Adam Jones
Sent: Tuesday, September 27, 2005 5:09 PM
To: [hidden email]
Subject: RE: printing encrypted strings


What type of encryption are you using? And what function are you using to
print it out. I have used cout and it works fine with that.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Sheehan, Tim
Sent: Tuesday, September 27, 2005 3:46 PM
To: '[hidden email]'
Subject: printing encrypted strings

Hi,
I am trying to store encrypted data into an ascii file.  
The encrypted output appears to be in a binary format.  
Are there SSL functions I should use to convert to an ascii format before
moving it to the file?

thx,
Tim
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]


Confidentiality Notice:

This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the named addressee you should not disseminate, distribute or
copy this e-mail. Please notify the sender immediately by e-mail if you have
received this e-mail by mistake and delete this e-mail from your system.  If
you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents of
this information is strictly prohibited.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: printing encrypted strings

Adam Jones-2
Use fprintf with the %d format specifier. As you loop thru your buffer to
print the encrypted buffer out to your file.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Sheehan, Tim
Sent: Tuesday, September 27, 2005 4:23 PM
To: '[hidden email]'
Subject: RE: printing encrypted strings

I'm working in C.

I'm actually using the AES 256 algorithm. It has been bolted in to the SSL
like DES(and other enc algs).  The encryption piece appears to be working
well.  I can cipher&decipher without any issues.  It is when I store that
encrypted string to a file.
The file being written is opened with fopen and then fwrite and fread are
used to write & read.  

When I write it out to the file is shows up in a binary format eq.

"\326\34368^H\316f]\234^E\371^C\342\246\217<d=\341?^R\310\237[>3^\:\236\241\
206\243"

Then when I am reading it back, the unique characters are interpreted
incorrectly.
T

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]On Behalf Of Adam Jones
Sent: Tuesday, September 27, 2005 5:09 PM
To: [hidden email]
Subject: RE: printing encrypted strings


What type of encryption are you using? And what function are you using to
print it out. I have used cout and it works fine with that.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Sheehan, Tim
Sent: Tuesday, September 27, 2005 3:46 PM
To: '[hidden email]'
Subject: printing encrypted strings

Hi,
I am trying to store encrypted data into an ascii file.  
The encrypted output appears to be in a binary format.  
Are there SSL functions I should use to convert to an ascii format before
moving it to the file?

thx,
Tim
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]


Confidentiality Notice:

This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the named addressee you should not disseminate, distribute or
copy this e-mail. Please notify the sender immediately by e-mail if you have
received this e-mail by mistake and delete this e-mail from your system.  If
you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents of
this information is strictly prohibited.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]


Confidentiality Notice:

This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.  If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.  If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: printing encrypted strings

Ken Goldman
In reply to this post by Sheehan, Tim
Are you sure that those "unique characters" are individually there?
If you're writing in binary, it's likely that you have binary in the
file, and what "shows up" is your editor's valiant attempt to display
non-printable characters.

Try editing the file in emacs in hexl-mode and let emacs do the binary
to ascii conversion for you and show you what's there.

You could do a conversion to-from binary (sprintf, sscanf) if you want
to view the result for debugging, although I typically just let emacs
do it.  Aside from debugging, storing in binary should be fine.

> From: "Sheehan, Tim" <[hidden email]>
> Date: Tue, 27 Sep 2005 18:23:27 -0300
>
> I'm working in C.
>
> I'm actually using the AES 256 algorithm. It has been bolted in
> to the SSL like DES(and other enc algs).  The encryption piece
> appears to be working well.  I can cipher&decipher without any
> issues.  It is when I store that encrypted string to a file.
> The file being written is opened with fopen and then fwrite
> and fread are used to write & read.  
>
> When I write it out to the file is shows up in a binary format eq.
>
> "\326\34368^H\316f]\234^E\371^C\342\246\217<d=\341?^R\310\237[>3^\:\236\241\
> 206\243"
>
> Then when I am reading it back, the unique characters are interpreted
> incorrectly.
> T
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of Adam Jones
> Sent: Tuesday, September 27, 2005 5:09 PM
> To: [hidden email]
> Subject: RE: printing encrypted strings
>
>
> What type of encryption are you using? And what function are you using to
> print it out. I have used cout and it works fine with that.
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Sheehan, Tim
> Sent: Tuesday, September 27, 2005 3:46 PM
> To: '[hidden email]'
> Subject: printing encrypted strings
>
> Hi,
> I am trying to store encrypted data into an ascii file.  
> The encrypted output appears to be in a binary format.  
> Are there SSL functions I should use to convert to an ascii format before
> moving it to the file?



--
Ken Goldman   [hidden email]   914-784-7646
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: printing encrypted strings

Bear Giles
In reply to this post by Sheehan, Tim
There's a BIO that handles BASE-64 encoding and decoding.  It
makes the files much friendlier to naive editors and operating
systems since it forces the contents to standard ASCII characters
and you aren't dealing with \xxx encodings in your editors.  Does
DOS/Windows still need that silly explicit "binary" vs "character"
mode on fopen()?  If it does, it could be something as simple as
LF -> CRLF coercion.

The only other question is whether you're sure you're reading and
writing all of the available data, using an element size of one,
etc.  All the boring standard stuff when using fread()/fwrite().

Bear

Sheehan, Tim wrote:

> I'm working in C.
>
> I'm actually using the AES 256 algorithm. It has been bolted in
> to the SSL like DES(and other enc algs).  The encryption piece
> appears to be working well.  I can cipher&decipher without any
> issues.  It is when I store that encrypted string to a file.
> The file being written is opened with fopen and then fwrite
> and fread are used to write & read.  
>
> When I write it out to the file is shows up in a binary format eq.
>
> "\326\34368^H\316f]\234^E\371^C\342\246\217<d=\341?^R\310\237[>3^\:\236\241\
> 206\243"
>
> Then when I am reading it back, the unique characters are interpreted
> incorrectly.
> T
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]