× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Bruce,

I' m come back to you about this topic.

In the last days i try to play with your example and all seem work fine, but now i' m again lost

I receive from a supplyer the following encrypt data. Dare are encode in base64 encode and encrypted with AES-128 ECB mode .

Key is &E)H@McQfTjWnZr4

I try to

- decode base64

- convert from ascii to ebcdic

- decrypt it

But it's does not work.

I try also

- decode base64

- decrypt it

- convert from ascii to ebcdic

Nothing again.

Have you any idea ?

Thanks a lot for your contribution


ENCRYPTED TEXT

DXuHM7J/bvJ8lfpMiV4RgLjlRG4BYBUHETKW9VYgPfwz1zbNuelll3QXAFqrk8B5cqnwC/wrnTyjCy8fb/vaeCVe0BuEIT4hSFwAJ8wtG6kz1zbNuelll3QXAFqrk8B5yqSftD+NTUYpvUoXZIdHDDPXNs256WWXdBcAWquTwHkz1zbNuelll3QXAFqrk8B5BMcHFvguWga31rFjbmrX/YBUphhsLq0tjdx1QMEFaXMz1zbNuelll3QXAFqrk8B5M9c2zbnpZZd0FwBaq5PAeTPXNs256WWXdBcAWquTwHkz1zbNuelll3QXAFqrk8B5Lveva9Mf22DLe8rd9jqsnU4am+7plvwBt1KbEjCquIeY5t88zVJFeJ2Tw4Pk5aULM9c2zbnpZZd0FwBaq5PAecNoMMA2ZqWJzo+6jPukhirwsnBPO5shRJepcndOndrBdv63Qx64DhQFCoyu7xth+VAzruGAb5iTnxmzBeF0cQIz1zbNuelll3QXAFqrk8B52B9LSBNBrDOE1MTmsZs2DdImF3dEfI3qPZO3HHKp2utoS3kaBgWEIP78py59Jk8lF9vXUGX7QaIRU0zE5ch9QzOEHWsCeqTOyYlLuDWHj9axekLIWvK3VX2I0+cTmoXbR2O5MSPSd7GuxUqUYCGwWR14JxIJzGSb1niDevTL5vcRQ0dKcwweT5/Sha5KoBH4OHckptZyMbmwtkwPN8/BdHOQHrDb7deZT9FTr8aq7bsz1zbN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zbnpZZd0FwBaq5PAeTPXNs256WWXdBcAWquTwHkz1zbNuelll3QXAFqrk8B5M9c2zbnpZZd0FwBaq5PAeTPXNs256WWXdBcAWquTwHkz1zbNuelll3QXAFqrk8B5M9c2zbnpZZd0FwBaq5PAeTPXNs256WWXdBcAWquTwHkz1zbNuelll3QXAFqrk8B5M9c2zbnpZZd0FwBaq5PAeTPXNs256WWXdBcAWquTwHkz1zbNuelll3QXAFqrk8B5M9c2zbnpZZd0FwBaq5PAeTPXNs256WWXdBcAWquTwHkz1zbNuelll3QXAFqrk8B5M9c2zbnpZZd0FwBaq5PAeTPXNs256WWXdBcAWquTwHkz1zbNuelll3QXAFqrk8B5M9c2zbnpZZd0FwBaq5PAeTPXNs256WWXdBcAWquTwHmoylax51sZRUr3OEevStWU


result

12345620181021Contattaci Sig.ra Mario Rossi mario.rossi@xxxxxxxxx<mailto:mario.rossi@xxxxxxxxx> +39 0110262750 0100 SJNFCAF15U7200581FC075EA Nissan Juke Activa 1.8 STY Benzina 100000,0020190121999999https://rotalnordauto.concessionarienissan.it/it/veicoli/nissan/juke/15-dci-acenta-s1bv9d33 Servizi richiesti 20190121Testo del messaggio relativo al veicolo o servizio. YY


Basilio MERLINO
Phone: +39-0690808577
Mobile: +39-3484152040



Il 02/02/2019 09:43, Merlino, Basilio (NissanContractor) ha scritto:

Fantastic Bruce I ll try it and let you know
Thanks for your support on this
Basilio

Il 1 feb 2019 21:03, Bruce Vining <bruce.vining@xxxxxxxxx><mailto:bruce.vining@xxxxxxxxx> ha scritto:
I hope that the supplier can provide you with the specifics of their
encryption. The referenced site aes.online-domain-tools.com site is a bit
vague on a few points.

What I needed to do is use hex input for the text and key (as neither were
multiples of 16 bytes), along with specifying the following values:

Input type: Text
Input text (hex) : 48454c4c4f204259204d452020202020
Function: AES
Mode: ECB
Key (hex) : 656e6372797074696f6e206b65790000

The site doesn't mention what text padding it does for AES though on the i
I tried both blank and null padding of the text field, neither of which
generated the same encrypted value the tool did
(x'8c5dacb236d9576289b05e6e58ab94cd'). Using hardcoded text blanks (x'20'
for ASCII) for the input text did work. The site does mention "If you don't
specify a key with permitted length the key is prolonged with the proper
number of null bytes at the end", however I again only found the correct
value being generated when I used hex input of the key (and not just
'encryption key'). I did also find that using text of 'HELLO BY ME12345'
and a key of 'encryption key12' (causing no padding of either element) also
worked, so there's something about the site padding that I'm missing...).
The site also prompts for an initialization vector, which is not supported
by Qc3EncryptData.

The following program did, using eval ASCIIEncTxt, generate the same
'8C5DACB236D9576289B05E6E58AB94CD' value as the tool.

h dftactgrp(*no)

d ConvClose pr 10i 0 extproc('iconv_close')
d iconv 52a value

d ConvOpen pr 52a extproc('iconv_open')
d ToCode 32a const
d FromCode 32a const

d ConvText pr 10i 0 extproc('iconv')
d iconv 52a value
d InpBfr * const
d InBfrLeft 10i 0
d OutBfr * const
d OutBfrLft 10i 0

d Encrypt pr extproc('Qc3EncryptData')
d ClrDta 16a
d LenClrDta 10i 0 const
d FmtClrDta 8a const
d ALGD0200 const likeds(ALGD0200)
d FmtAlg 8a const
d KEYD0200 const likeds(KEYD0200)
d FmtKey 8a const
d CryptoPrv 1a const
d CryptoDev 10a const
d EncDta 16a
d LenPrvEncDta 10i 0 const
d BytRtnEncDta 10i 0
d ErrCde likeds(QUSEC)

d ALGD0200 ds
d BlkCphrAlg 10i 0
d BlkLen 10i 0
d Mode 1a
d PadOpt 1a inz('0')
d PadChr 1a inz(x'00')
d Rsvd 1a inz(x'00')
d LenMAC 10i 0 inz(x'00')
d EffKeySiz 10i 0 inz(0)
d InzVector 32a inz(*allx'00')

d FromCode ds
d 8a inz('IBMCCSID')
d FromCCSID 5a inz('00037')
d ConvAlt 3a inz('000')
d SubAlt 1a inz('0')
d SSAlt 1a inz('0')
d InpLenOpt 1a inz('0')
d ErrOptMxd 1a inz('0')
d 12a inz(*allx'00')

d KEYD0200 ds
d KeyType 10i 0
d KeyLen 10i 0
d KeyFmt 1a inz('0')
d 3a inz(*allx'00')
d ASCIIKey 16a

d ToCode ds
d 8a inz('IBMCCSID')
d ToCCSID 5a inz('00819')
d 19a inz(*allx'00')

d ASCIIClrTxt s 16a
d ASCIIClrTxtPtr s * inz(%addr(ASCIIClrTxt))
d ASCIIEncTxt s 16a
d ASCIIKeyPtr s * inz(%addr(ASCIIKey))
d ConvErr s 10i 0
d EBCClrTxt s 16a inz('HELLO BY ME')
d EBCClrTxtPtr s * inz(%addr(EBCClrTxt))
d EBCKey s 16a
d EBCKeyPtr s * inz(%addr(EBCKey))
d InBfrLeft s 10i 0
d LenRtnd s 10i 0
d OutBfrLeft s 10i 0

/copy qsysinc/qrpglesrc,iconv
/copy qsysinc/qrpglesrc,qusec

/free
EBCKey = 'encryption key' + x'0000';
iconv = ConvOpen(ToCode :FromCode);
InBfrLeft = %size(EBCClrTxt);
OutBfrLeft = %size(ASCIIClrTxt);
ConvErr = ConvText(iconv :EBCClrTxtPtr :InBfrLeft
:ASCIIClrTxtPtr :OutBfrLeft);
InBfrLeft = %size(EBCKey);
OutBfrLeft = %size(ASCIIKey);
ConvErr = ConvText(iconv :EBCKeyPtr :InBfrLeft
:ASCIIKeyPtr :OutBfrLeft);
ConvErr = ConvClose(iconv);
BlkCphrAlg = 22; // AES
BlkLen = 16;
Mode = '0'; // ECB
KeyType = 22;
KeyLen = 16;
QUSBPrv = %size(QUSEC);
Encrypt(ASCIIClrTxt :%size(ASCIIClrTxt) :'DATA0100'
:ALGD0200 :'ALGD0200'
:KEYD0200 :'KEYD0200' :'0' :' '
:ASCIIEncTxt :%size(ASCIIEncTxt) :LenRtnd :QUSEC);
*inlr = *on;
return;
/end-free

I hope this helps,
Bruce

On Fri, Feb 1, 2019 at 8:06 AM Bruce Vining <bruce.vining@xxxxxxxxx><mailto:bruce.vining@xxxxxxxxx> wrote:



Give me a few minutes and I'll write up a little program mimicking your
website solution. But I can tell you that you have several problems in
regard to the actual file decryption approach.

On Fri, Feb 1, 2019 at 8:04 AM Merlino, Basilio (NissanContractor) <
b.merlino-extern@xxxxxxxxx<mailto:b.merlino-extern@xxxxxxxxx>> wrote:



Hi Bruce,

Thanks for your support, below my answer


1. Are you using binary when FTPing the file?
No but in any case the issue is present also when i decrypt the text
"HELLO BY ME" and compare it

2. How are you opening the file?
3. What is the CCSID of the system providing the decryption key?
It's a unix system
4. When you say you "convert string from ebcdic to ascii" are you
referring
to the decryption key?
No to the text "HELLO BY ME"
5. How do you detect that the decryption failed? Using debug of the text
or
by examining an output file?

Debug and compare the value with the result of
http://rc4.online-domain-tools.com/


Basilio MERLINO
Phone: +39-0690808577
Mobile: +39-3484152040



Il 01/02/2019 14:50, Bruce Vining ha scritto:

First a few questions:

1. Are you using binary when FTPing the file?
2. How are you opening the file?
3. What is the CCSID of the system providing the decryption key?
4. When you say you "convert string from ebcdic to ascii" are you
referring
to the decryption key?
5. How do you detect that the decryption failed? Using debug of the text
or
by examining an output file?

Bruce

On Fri, Feb 1, 2019 at 7:29 AM Jay Vaughn <jeffersonvaughn@xxxxxxxxx<mailto:jeffersonvaughn@xxxxxxxxx>


<mailto:jeffersonvaughn@xxxxxxxxx><mailto:jeffersonvaughn@xxxxxxxxx> wrote:





Curious to see suggestions on this one.
I have nothing, sorry.

But just curious why the data wasn’t sftp’d to you instead? But I’m sure
I just don’t see the whole picture of what you are working on.

Jay




On Feb 1, 2019, at 8:18 AM, Merlino, Basilio (NissanContractor) <


b.merlino-extern@xxxxxxxxx<mailto:b.merlino-extern@xxxxxxxxx><mailto:b.merlino-extern@xxxxxxxxx><mailto:b.merlino-extern@xxxxxxxxx>> wrote:




Dear All,

I need to decrypt some text related data coming from a supplier, i


receive the file in an ftp folder read text and decrypt it.



In order to decrypt the information i use Qc3DecryptData (AES OR RC4


alghoritym), unforntunately i encoured in the following problem



First of all let's me say that i was not able to decrypt the data coming


from vendor so i try to understand where the problem was



First of all i have written a program that encrypt and decrypt the


phrase "HELLO BY ME" with key "key encryption" and it's work fine.



I compare the result with the one coming from the following url

http://rc4.online-domain-tools.com/

and the two values doesn't match.

So my first assumption was that there is a difference beetwen ebcdic and


ascii transcodification so i try to



- convert string from ebcdic to ascii

- run encryption

but again the two values doesn't match

Anyone can direct me ? any idea ?


Thanks to All


Basilio













***********************************************************************************************************


CONFIDENTIALITY NOTICE

This message is for the named person's use only. It may contain


confidential, proprietary or legally privileged information.



If you receive this message in error, please immediately delete it and


all copies of it from your system, destroy any hard copies of it and
notify
us by email to email.security@xxxxxxxxxxxxxxxxx<mailto:email.security@xxxxxxxxxxxxxxxxx><mailto:
email.security@xxxxxxxxxxxxxxxxx><mailto:email.security@xxxxxxxxxxxxxxxxx> with a copy of this
message. You must not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message if you are not the intended
recipient. NISSAN EUROPE and any of its subsidiaries each reserves the
right to monitor all e-mail communications through its networks.



NISSAN EUROPE is neither liable for the proper, complete transmission of


the information contained in this communication nor any delay in its
receipt. This email was scanned for the presence of computer viruses. In
the unfortunate event of infection NISSAN EUROPE does not accept
liability.



Any views expressed in this message are those of the individual sender,


except where the message states otherwise and the sender is authorised to
state them.







***********************************************************************************************************


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)


mailing list


To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx><mailto:
RPG400-L@xxxxxxxxxxxxxxxxxx><mailto:RPG400-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx><mailto:
RPG400-L-request@xxxxxxxxxxxxxxxxxx><mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx<mailto:support@xxxxxxxxxxxx><mailto:support@xxxxxxxxxxxx><mailto:support@xxxxxxxxxxxx> for any
subscription related


questions.



Help support midrange.com by shopping at amazon.com with our affiliate


link: https://amazon.midrange.com
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx><mailto:
RPG400-L@xxxxxxxxxxxxxxxxxx><mailto:RPG400-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx><mailto:
RPG400-L-request@xxxxxxxxxxxxxxxxxx><mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx<mailto:support@xxxxxxxxxxxx><mailto:support@xxxxxxxxxxxx><mailto:support@xxxxxxxxxxxx> for any
subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com








***********************************************************************************************************
CONFIDENTIALITY NOTICE

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information.

If you receive this message in error, please immediately delete it and
all copies of it from your system, destroy any hard copies of it and notify
us by email to email.security@xxxxxxxxxxxxxxxxx<mailto:email.security@xxxxxxxxxxxxxxxxx> with a copy of this
message. You must not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message if you are not the intended
recipient. NISSAN EUROPE and any of its subsidiaries each reserves the
right to monitor all e-mail communications through its networks.

NISSAN EUROPE is neither liable for the proper, complete transmission of
the information contained in this communication nor any delay in its
receipt. This email was scanned for the presence of computer viruses. In
the unfortunate event of infection NISSAN EUROPE does not accept liability.

Any views expressed in this message are those of the individual sender,
except where the message states otherwise and the sender is authorised to
state them.


***********************************************************************************************************
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx<mailto:support@xxxxxxxxxxxx> for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com





--
Thanks and Regards,
Bruce
931-505-1915





--
Thanks and Regards,
Bruce
931-505-1915
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx<mailto:support@xxxxxxxxxxxx> for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

***********************************************************************************************************
CONFIDENTIALITY NOTICE

This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information.

If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify us by email to email.security@xxxxxxxxxxxxxxxxx<mailto:email.security@xxxxxxxxxxxxxxxxx> with a copy of this message. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. NISSAN EUROPE and any of its subsidiaries each reserves the right to monitor all e-mail communications through its networks.

NISSAN EUROPE is neither liable for the proper, complete transmission of the information contained in this communication nor any delay in its receipt. This email was scanned for the presence of computer viruses. In the unfortunate event of infection NISSAN EUROPE does not accept liability.

Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them.

***********************************************************************************************************


***********************************************************************************************************
CONFIDENTIALITY NOTICE

This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information.

If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify us by email to email.security@xxxxxxxxxxxxxxxxx with a copy of this message. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. NISSAN EUROPE and any of its subsidiaries each reserves the right to monitor all e-mail communications through its networks.

NISSAN EUROPE is neither liable for the proper, complete transmission of the information contained in this communication nor any delay in its receipt. This email was scanned for the presence of computer viruses. In the unfortunate event of infection NISSAN EUROPE does not accept liability.

Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them.

***********************************************************************************************************

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.