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

  • SEARCH
  • Home
  • 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 7985845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:40:30+00:00 2026-06-04T11:40:30+00:00

I know very little about Encryption, but my goal is to essentially decrypt strings.

  • 0

I know very little about Encryption, but my goal is to essentially decrypt strings. I have been given the AES(128) key.

However, I must retrieve the IV from the Encrypted string, which is the first 16 bits.

Heres the doc for salesforce for more information (if what i explained was incorrect)

Encrypts the blob clearText using the specified algorithm and private
key. Use this method when you want Salesforce to generate the
initialization vector for you. It is stored as the first 128 bits (16
bytes) of the encrypted blob

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_restful_crypto.htm (encryptWithManagedIV)

For Retrieving the IV I’ve tried something like this (I don’t believe it’s right though):

public string retrieveIv()
        {
            string iv = "";
            string input = "bwZ6nKpBEsuAKM8lDTYH1Yl69KkHN1i3XehALbfgUqY=";
            byte[] bytesToEncode = Encoding.UTF8.GetBytes(input);

            for(int i = 0; i <= 15; i++){
                iv += bytesToEncode[i].ToString(); ;
            }

            return iv;
        }

(Just ignore the fact that the input is hardcoded and not parameterized; easier for testing purposes)

Then use the Best answer from this question to decrypt the string

  • 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-04T11:40:32+00:00Added an answer on June 4, 2026 at 11:40 am

    The IV shouldn’t be expressed as a string – it should be as a byte array, as per the AesManaged.IV property.

    Also, using Encoding.UTF8 is almost certainly wrong. I suspect you want:

    public static byte[] RetrieveIv(string encryptedBase64)
    {
        // We don't need to base64-decode everything... just 16 bytes-worth
        encryptedBase64 = encryptedBase64.Substring(0, 24);
    
        // This will be 18 bytes long (4 characters per 3 bytes)
        byte[] encryptedBinary = Convert.FromBase64String(encryptedBase64);
        byte[] iv = new byte[16];
    
        Array.Copy(encryptedBinary, 0, iv, 0, 16);
        return iv;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know very little about Java but I'm attempting to run this applet from
I know very little about JavaScript but despite this I'm trying to cobble something
Pardon me if this has already been asked (I know very little about Data
I know very little about Agile but I wonder if there is any difference
I know very little about SQL. My app is running Rails 3.0.9. I have
To begin with, I know very little about DTSX files and SSIS, but my
Okay, I'll say now that I know very little about Java. I was given
I'm actually translating some C++ code (which I know very little about, and have
I know very little about web programming but I need to establish a license
I was recently given a project to modify and I know very little about

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.