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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:15:49+00:00 2026-06-10T07:15:49+00:00

I was tasked to port AES encryption from Java to Objective-C. I don’t have

  • 0

I was tasked to port AES encryption from Java to Objective-C. I don’t have access to the server’s code where decryption took place. Using FBEncryptor, I’ve managed to do a simple AES encrypt of a string in Objective-C and decrypted it in Java and vice versa.

However, when I tried to send an encrypted data in Objective-C to server (which again, I don’t have access to), the server sent me an “DER input not an octet string” fault. I figured that this code in Java, which I cannot replicate in Objective-C that is holding my path to success in the task.

Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, sKey);
String ivBase64 = Base64.encodeBytes(cipher.getParameters().getEncoded());

The ivBase64 was sent to the server along with the encrypted String.

Any help in how to port this little part cipher.getParameters().getEncoded() to Objective-C is very much appreciated.

Thanks.

  • 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-10T07:15:50+00:00Added an answer on June 10, 2026 at 7:15 am

    What is happening is that the cipher.getParameters() call returns an instance of AlgorithmParameters. This instance has a method getEncoded() that has the following description:

    Returns the parameters in their primary encoding format. The primary encoding format for parameters is ASN.1, if an ASN.1 specification for this type of parameters exists.

    Now, as far as I know, there is no such thing as a default ASN.1 DER encoding for an IV, but since an IV is basically a byte array, the most logical ASN.1 encoding is the OCTET STRING. When DER encoded, this ASN.1 type has a tag with value 04h and then the length. The length will always the size of the IV directly encoded a single byte. The IV will always have the size of the block of the underlying cipher, which is always 16 bytes for AES.

    So finally, you should be OK by prepending the bytes valued 04h and 10h to the IV.

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

Sidebar

Related Questions

I have been tasked with porting a large Java codebase to the Android platform.
I've been tasked with porting/refactoring a Web Application Platform that we have from ASP.NET
I was tasked with migrating data from a MSSQL server to a MySQL server.
Ok, I've been tasked to port/convert/upgrade a site at work from table based layout
I have been tasked with testing some XSLT code to ensure that it is
I have been tasked to run a script from cron, so I have written
At work I have been tasked with implementing a TCP server as part of
I have successfully talked to the computer from an Arduino via serial USB port
So I have been tasked with modifying the Stories Overview report for TFS. I
Background: I've been tasked with converting an Access database application to ASP.Net C# MVC.

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.