Convert to base64 help (Cross posted from IBM-Main)

518 views
Skip to first unread message

Ward, Mike S

unread,
Aug 8, 2014, 9:53:23 AM8/8/14
to ASSEMBL...@listserv.uga.edu
Hello all, I have found two assembler programs that are supposed to convert data to base64. They do not seem to be working correctly. I have gone to two sites on the internet that do online base64 conversions. I place a 32 byte string of data into the input area and press the encode button. The data returned does not match what the mainframe base64 assembler program returned. I tried the data at 3 different internet sites. All three sited returned the same results. I tried both assembler programs and used the same input string that I used at the internet sites. The string generated on the mainframe does not match what was returned at the internet sites. Ami missing something? Are the programs broken? Any help appreciated. (Z/os V1.13)

TIA
Mike.

==========================
This email, and any files transmitted with it, is confidential and intended solely for the use of the individual or entity to which it is addressed. If you have received this email in error, please notify the system manager. This message contains confidential information and is intended only for the individual named. 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 message 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.

Fred.van....@mail.ing.nl

unread,
Aug 8, 2014, 10:10:37 AM8/8/14
to ASSEMBL...@listserv.uga.edu
The internet sites use an ASCII or UTF representation of the text string you enter, the mainframe uses EBCDIC. The base64 result will differ because the source string has a different binary content.

Sent from my iPhone
-----------------------------------------------------------------
ATTENTION:
The information in this electronic mail message is private and
confidential, and only intended for the addressee. Should you
receive this message by mistake, you are hereby notified that
any disclosure, reproduction, distribution or use of this
message is strictly prohibited. Please inform the sender by
reply transmission and delete the message without copying or
opening it.

Messages and attachments are scanned for all viruses known.
If this message contains password-protected attachments, the
files have NOT been scanned for viruses by the ING mail domain.
Always scan attachments before opening them.
-----------------------------------------------------------------

Pieter Wiid

unread,
Aug 8, 2014, 10:12:17 AM8/8/14
to ASSEMBL...@listserv.uga.edu
Without your code, it's difficult to say. However, going on the Wikipedia
info, the obvious check is ASCII vs EBCDIC.
I suggest you add a convert-to-ascii to the code & compare results then.

Pieter

Ward, Mike S

unread,
Aug 8, 2014, 12:34:37 PM8/8/14
to ASSEMBL...@listserv.uga.edu
Thanks to all who replied. You are correct. Adding an EBCDIC to ASCII conversion routine resolved the problem.

Thanks for all the replies.

-----Original Message-----
From: Alex Kodat [mailto:ako...@rocketsoftware.com]
Sent: Friday, August 08, 2014 9:14 AM
To: ASSEMBL...@listserv.uga.edu; Ward, Mike S
Subject: Re: Convert to base64 help (Cross posted from IBM-Main)

Mike,

Are you sure the strings on the mainframe are being represented as ASCII (or UTF-8)? Obviously, the base64 encoding of an EBCDIC string will have a different value from the base64 encoding of the equivalent ASCII string.
--
Alex Kodat
Senior Product Architect
Rocket Software
t: +1 781 684 2294 • m: +1 315 527 4764
e: ako...@rocketsoftware.com • w: www.rocketsoftware.com ================================ Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ +1 800.966.3270+1 781.577.4321 Unsubscribe From Commercial Email – unsub...@rocketsoftware.com Manage Your Subscription Preferences - http://info.rocketsoftware.com/GlobalSubscriptionManagementEmailFooter_SubscriptionCenter.html
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy
================================

Phil Smith III

unread,
Aug 9, 2014, 12:29:38 AM8/9/14
to ASSEMBL...@listserv.uga.edu
"Ward, Mike S" wrote:
>Thanks to all who replied. You are correct. Adding an EBCDIC to ASCII conversion routine resolved the problem.

Note, however, that it validates your routine but does NOT mean you want to be doing this conversion with your data before Base64ing it, because you're just going to mess up the data. Or if your data is in the set of "normal" characters, why are you Base64ing it? What's the problem you're trying to solve here?

Base64 is normally used to allow safe transmission of strings that may contain non-typable/non-translatable characters.

Apologies if you knew this; it just sounded like "Oh, good, now that I've added etoa() I'm done"...

...phsiii

Robert A. Rosenberg

unread,
Aug 9, 2014, 5:26:33 AM8/9/14
to ASSEMBL...@listserv.uga.edu
At 00:29 -0400 on 08/09/2014, Phil Smith III wrote about Re: Convert
to base64 help (Cross posted from IBM-Main):

>Base64 is normally used to allow safe transmission of strings that
>may contain non-typable/non-translatable characters.

One of the original purposes/uses of Base64 was for sending email
attachments when dealing with 7-bit (as opposed to 8-bit)
transmission paths. Now that in most cases the session is done via
8-bit clean paths this need is less important.

Mar...@pi-sysprog.de

unread,
Aug 9, 2014, 6:18:59 AM8/9/14
to ASSEMBL...@listserv.uga.edu
>> One of the original purposes/uses of Base64 was for sending email
attachments when dealing with 7-bit (as opposed to 8-bit)
transmission paths. Now that in most cases the session is done via
8-bit clean paths this need is less important.

How about XML documents? They do need UTF-8, but compressed data will
have codes in it that are not valid UTF-8 char.

Or hashcodes of content might end up with non valid UTF-8
combinations.

Here Base64 comes in handy.



--
Martin

Pi_cap_CPU - all you ever need around MWLC/SCRT/CMT in z/VSE
more at http://www.picapcpu.de

Paul Gilmartin

unread,
Aug 9, 2014, 9:31:27 AM8/9/14
to ASSEMBL...@listserv.uga.edu
I've not found that to be true "in most cases". More often, I can
negotiate an 8-bit connection with SMTP only to find when the message
arrives that some interloper has converted it to base64 or Q-P.

They don't trust each other.

-- gil

Ward, Mike S

unread,
Aug 11, 2014, 10:00:59 AM8/11/14
to ASSEMBL...@listserv.uga.edu
We are writing a requestor client in CICS, and are communicating with a web service on a distributed box. They require us to digitally sign the request message. The little box does not understand EBCDIC, so I have to convert the signature to ascii.

Paul Gilmartin

unread,
Aug 11, 2014, 10:42:51 AM8/11/14
to ASSEMBL...@listserv.uga.edu
On 2014-08-11, at 08:00, Ward, Mike S wrote:

> We are writing a requestor client in CICS, and are communicating with a web service on a distributed box. They require us to digitally sign the request message. The little box does not understand EBCDIC, so I have to convert the signature to ascii.
>
Good explanation. Yet I am left wondering:

o If the signature is intrinsically, at the lowest level, a
binary datum which must be expressed as text, why it is
first converted to (useless) EBCDIC, requiring a further
conversion to ASCII.

o Once the signature is expressed as ASCII text, why it must
be further encoded as base64?

-- gil

Mar...@pi-sysprog.de

unread,
Aug 11, 2014, 10:56:09 AM8/11/14
to ASSEMBL...@listserv.uga.edu
Mike,

>> We are writing a requestor client in CICS, and are communicating with
>> a web service on a distributed box. They require us to digitally sign the
>> request message. The little box does not understand EBCDIC, so I have
>> to convert the signature to ascii.

Ah- now we are getting to the bottom of it.

First question- What CICS? CICS in z/VSE does need a totally different
approach.

For the rest of my answer I assume we are talking z/VSE-

Before you do any digital signing you need to convert it to the code
that the recipient does use - and then produce the digital signature
and then convert that binary singature to BASE64 (in ASCII) - You can
can then proceed and call IESHTTP (since IESSOAP from IBM insists in
translating the stuff to UNICODE- which is done already anyway- aside
of that it does not handle applictype SOAP).
Reply all
Reply to author
Forward
0 new messages