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 8698919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:49:49+00:00 2026-06-13T01:49:49+00:00

I have data encrypted in ColdFusion which I am trying to decrypt in Ruby.

  • 0

I have data encrypted in ColdFusion which I am trying to decrypt in Ruby. I can’t get the output to match though.

On the ColdFusion side I have something like this:

<cfset key = 'DiYVka4mAYk=' /> 
<cfset str = 'hello' />

<cfset enc = encrypt(str, key, 'des', "base64") />
<cfset dec = decrypt(enc, key, 'des', "base64") />

<cfoutput>
#str#   <!--- 'hello' --->
<br />
#enc#   <!--- '3rNKAnEu+VA=' --->
<br />
#dec#   <!--- 'hello' --->
</cfoutput>

The same, implemented in Ruby:

require 'openssl'
require 'base64'

str = 'hello'
key = 'DiYVka4mAYk='

des = OpenSSL::Cipher.new('des')

des.encrypt 
des.key = key
data = des.update(str) + des.final  
enc = Base64.encode64(data)

des.decrypt
des.key = key
dec = des.update(Base64.decode64(enc)) + des.final  

puts str  # => 'hello'
puts enc  # => 'wVQs6NjOZwM='
puts dec  # => 'hello'

Both work, but the encrypted strings are different. So passing encrypted data between ColdFusion and Ruby is not going to work.

The key was generated using ColdFusion’s generateSecretKey() function. It looks Base64 encoded, so I tried setting the key like this in Ruby:

key = Base64.decode64('DiYVka4mAYk=')

Again, the code works but the encrypted string is different.

Is there anything I am missing regards key encoding?

Also, I thought maybe there is more info implied when setting the algorithm to ‘des’ in ColdFusion. So I tried creating the Cipher in ruby with the following:

  • des
  • des-cbc
  • des-cfb
  • des-ecb
  • des-ede
  • des-ede-cbc
  • des-ede-cfb
  • des-ede-ofb
  • des-ofb

Again, some variation in the encrypted string. But none matching the original ColdFusion version.

Note: the ColdFusion encryption has been in use for a long time, so I can’t make any edits on that side. The ‘fix’ must be in Ruby.

  • 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-13T01:49:50+00:00Added an answer on June 13, 2026 at 1:49 am

    As asked, I’ll transfer my comment to an answer:

    You have to ensure that the cipher modes, IVs, and padding match from both ends.

    The Ruby defaults in 1.8.7 and 1.9.3 are ECB and no IV, and PCKS padding. The ColdFusion defaults are the same.

    However it appears that in ruby 1.9.2, or in your particular environment, the default cipher mode is not ECB, which is changing the output. As you commented, setting the cipher mode to ECB manually (OpenSSL::Cipher.new(“DES-ECB”)) fixes the issue.

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

Sidebar

Related Questions

I have some data from a external party which is encrypted according to them
I have the following encrypted data: U2FsdGVkX1+21O5RB08bavFTq7Yq/gChmXrO3f00tvJaT55A5pPvqw0zFVnHSW1o The pass to decrypt it is: password
We have data files which are encrypted in our wpf app. We would like
I have AES encrypted data stored in the database using php mysql. Which I
Basically, I'm trying to have an encrypted data flow between Java client and a
I have a pgp-encrypted file that I need to extract data from at runtime.
I have data from travel diaries which has been read in from a csv
I am inserting data in encrypted format so I have created a wallet in
I'd like to have sessions data encrypted like they are in suhosin, is there
Up to now, I thought that if I have RSA-encrypted data, this data would

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.