Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8106517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:29:40+00:00 2026-06-06T00:29:40+00:00

This is the function I use in OpenEdge 10.1B to encrypt a string with

  • 0

This is the function I use in OpenEdge 10.1B to encrypt a string with AES-128 OFB:

 DEFINE VAR cRes AS CHAR INITIAL ? NO-UNDO.
 DEFINE VAR rKey AS RAW NO-UNDO.
 DEFINE VAR rEnc AS RAW NO-UNDO

 rKey = GENERATE-PBE-KEY(cEncKey).

 eEnc = ENCRYPT(cData, rKey, ?, "AES_OFB_128").
 cRes = BASE64-ENCODE(rEnc) NO-ERROR.

 IF ERROR-STATUS::ERROR THEN cRes = ?.

 return cRes.

This function does encrypt well.

When I want to decrypt this with the following PHP, it fails, e.g. it gives me a different result than the original string.

// decrypted: original string is supposed to have 33 characters
$encrypted = "YnRvNjIG1kj1QtUM9ZYuVYS3D4LBYCEsprjg2QCaD/eM";
$key = "27Zkp6Wq";

$method = 'aes-128-ofb';

# do decryption
echo "<pre>".openssl_decrypt(base64_decode($encrypted), $method, $key, false)."</pre>";

I understand that might have something to do with the GENERATE-PBE-KEY function, but I fail to see how I can generate an PCKS#5 key in PHP.

Can someone please help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:29:43+00:00Added an answer on June 6, 2026 at 12:29 am

    This was too long for a comment. A few things to look at:

    1. The fourth parameter of openssl_decrypt should be true OR the first parameter should be left base64 encoded. Unless it was double base64 encoded 🙂

    2. Is the key base64 encoded or is that the raw key?

    3. From the OpenEdge it’s not entirely clear whether PBES1 (pbkdf1) or PBES2 (pbkdf2) is applied to the key, but the default settings use sha1 as the hash algorithm, no salt and 1000 as the iteration count. You can find example PHP implementations online.

    Having fiddled with your example I couldn’t get it to work, but the above should lead you in the right direction; btw, when I tried doing the encoding step in PHP it resulted in a much shorter encrypted string … I’m not sure what to think of that 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am confused why codeigniter wont let me use this: $(function() { var csrf
I use this function to scroll to a desired container: function scrolear(destino){ var stop
For example, if I do this: function bar(&$var) { $foo = function() use ($var)
I want to use this function EnumWindows(EnumWindowsProc, NULL);. The EnumWindowsProc is a Callback function:
I want to use this function: http://www.frankmacdonald.co.uk/php/post-to-wordpress-with-php.html Its used to post to Wordpress using
I use this function to find any installed application . But the parameter InstallLocation
I use this function substr(tbarticles.articlebody,1,200) as description1 in a query but for some articles
I am trying to use this function from a COM API which enables the
Following this question , I use this function to convert arrays to objects, function
I use the following jquery statements but i get error in this function onGetDataSuccess(result)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.