× 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.



Thanks Rob,that link just encodes like below but what i have observed it
that using this sqlrpgle program AES 128 encryption is not happening like
it's happening in the URL mentioned in previous email so I wanted same
functionality to be done using SQLRPGLE or any AS400 program.

[image: image.png]

On Fri, Sep 27, 2019 at 3:02 PM Rob Berendt <rob@xxxxxxxxx> wrote:

Three things to check on parameter one: data type, length, value.
According to the manual the data type
encrypted-data
An expression that must be a string expression that returns a complete,
encrypted data value of a CHAR FOR BIT DATA, VARCHAR FOR BIT DATA, BINARY,
VARBINARY, or BLOB built-in data type. The data string must have been
encrypted using the ENCRYPT_AES, ENCRYPT_RC2, or ENCRYPT_TDES function.
Not sure what the RPG types are for these two sql types: CHAR FOR BIT
DATA, VARCHAR FOR BIT DATA
I'm sure the "for bit data" is pretty important. It's not the default.
The manual doesn't seem to specify the length.

If the data type and the length are not the issue then the issue may be
the value of parameter one. Let me give you an example. Notice how the
manual specifies ENCRYPT_AES, ENCRYPT_RC2, ENCRYPT_TDES but the manual does
not specify that on the DECRYPT*functions? Let's assume that the first x
characters of the encrypted data indicate which method of decryption should
be used: AES, RC2, TDES. Perhaps your encryption matches none of the
above? I do not have the inclination to read the link provided to see how
your encryption was done. Not my day job... Only working on this to learn
more about encryption and just because I'm a nice guy.

Maybe there are additional messages in the joblog which will help
determine if it is the data type, the length or the value.
Or some RPG-SQL experts may chime in about sql to rpg data typing,
especially the 'for bit data' stuff.

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Rishi Seth
Sent: Friday, September 27, 2019 8:43 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Regarding Decryption of AES128 encrypted data in RPGLE and
query regarding CRC 32

CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know
the content is safe.


Additional Message Information



Message ID . . . . . . : SQL0171 Severity . . . . . . . : 30

Message type . . . . . : Diagnostic

Date sent . . . . . . : 19-09-27 Time sent . . . . . . :
14:30:33


Message . . . . : Argument 01 of function DECRYPT_CHAR not valid.

Cause . . . . . : The data type, length, or value of argument 01 of
function
DECRYPT_CHAR specified is not valid.

Recovery . . . : Refer to the DB2 for IBM i SQL Reference topic
collection
in the Database category in the IBM i Information Center for more

information on scalar functions. Correct the arguments specified for the

function. Try the request again.


it's encryption is done using AES 128 and with UTF8 format and with ECB
Mode and is generated with below URL:-
https://www.devglan.com/online-tools/aes-encryption-decryption

On Fri, Sep 27, 2019 at 2:08 PM Rob Berendt <rob@xxxxxxxxx> wrote:

Not sure how you're encoding it the first way and expect the IBM way
of decrypt to work.

As a side note, I strongly suggest you look at your joblog. That SQL
code will show up as a message in your joblog. The details on that
message will display a return code. The second level help will tell
you exactly what triggered off that sqlcode.

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Rishi Seth
Sent: Friday, September 27, 2019 4:32 AM
To: Midrange Systems Technical Discussion
<midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Regarding Decryption of AES128 encrypted data in RPGLE
and query regarding CRC 32

CAUTION: This email originated from outside of the organization. Do
not click links or open attachments unless you recognize the sender
and know the content is safe.


Can we directly use decryption function without doing encryption
programmatic way as we already have encoded values we just need to
decode it i tried the same but getting below error :-

1 **free
2 dcl-s enc varchar(130);
3 dcl-s psw char(31) ccsid(37)
4 inz('6-9d15-ec98bcc81ec4275OIM1TS7LI');
5 dcl-s text char(88) ccsid(37);
6 text = 'u3VtNgfyWU9faZc3Iaa8ZWbE5UZCfmC17yA4MyW0ghflt9dNQNDp+
7 CcgMZiG/kXPE4vv2CHL93B4iKiODHxxdVA==';
8 // exec SQL Set :enc = encrypt_AES(:text, :psw);
9 // DSPLY SQLCODE;
10
11 exec SQL Set :enc = decrypt_char(:text,:psw);
12 DSPLY SQLCODE;
13 eval *inlr=*on;

*SQLCODE = -171*

On Wed, Sep 25, 2019, 19:29 Peter Dow <petercdow@xxxxxxxxx> wrote:

In addition, note that the field in question is defined with keyword
CCSID(37), so system value should not matter.

On 9/25/2019 5:44 AM, Mark Waterbury wrote:
Rob,

The system that I performed that test on, that is back-level on
PTFs at
V7R3, has QCCSID=37.


I also performed the identical test on another V7R3 system that is
"up
to date" on PTFs, and it ran just fine.


Mark


On Wednesday, September 25, 2019, 7:34:56 AM EDT, Rob Berendt
<
rob@xxxxxxxxx> wrote:

Mark,

I think we've determined it's not the PTF's. It's the value of
DSPSYSVAL QCCSID.
Encryption hates 65535.

Rob Berendt



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact 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 Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact 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 Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact 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 Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact 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 Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

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


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.