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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:46:46+00:00 2026-05-26T04:46:46+00:00

I hope a smart guy will help me :) I receive a encrypted text

  • 0

I hope a smart guy will help me 🙂

I receive a encrypted text from a C# server and i’m unable to decrypt it correctly:
I always have an empty string. Normally the decrypted key should be

1111111111111111

(16time)

I use the AES128 algorithm for the decryption and the settings given by the back end (the guys who encrypted this text) are as follow :

  • Padding: PKCS7Padding
  • KeySize: 128
  • InitVector: null
  • Mode: CBC
  • text to decrypt (base64 encoded) : 1vycDn3ktoyaUkPlRAIlsA==
  • the key: 3a139b187647a66d

Here is the code i use for the decryption

- (NSData *)AES256DecryptWithKey:(NSString *)key {
// 'key' should be 32 bytes for AES256, will be null-padded otherwise
char keyPtr[kCCKeySizeAES2128+1]; // room for terminator (unused)
bzero(keyPtr, sizeof(keyPtr)); // fill with zeroes (for padding)

// fetch key data
[key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding];

NSUInteger dataLength = [self length];

//See the doc: For block ciphers, the output size will always be less than or 
//equal to the input size plus the size of one block.
//That's why we need to add the size of one block here
size_t bufferSize = dataLength + kCCBlockSizeAES128;
void *buffer = malloc(bufferSize);

size_t numBytesDecrypted = 0;
CCCryptorStatus cryptStatus = CCCrypt(kCCDecrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding,
                                 keyPtr, kCCKeySizeAES128,
                                 NULL /* initialization vector (optional) */,
                                 [self bytes], dataLength, /* input */
                                 buffer, bufferSize, /* output */
                                 &numBytesDecrypted);

if (cryptStatus == kCCSuccess) {
    //the returned NSData takes ownership of the buffer and will free it on deallocation
    return [NSData dataWithBytesNoCopy:buffer length:numBytesDecrypted];
}

free(buffer); //free the buffer;
return nil;

}

Thanx alot in advance for your help. I’m on this probleme since a long time with no answer in front of 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-05-26T04:46:47+00:00Added an answer on May 26, 2026 at 4:46 am

    The test input you’re using doesn’t appear to be using PKCS7 padding — it’s using no padding. I was able to get a successful decrypt using:

    echo 1vycDn3ktoyaUkPlRAIlsA== | openssl enc -aes-128-cbc -d -a -K `echo 3a139b187647a66d | xxd -ps` -iv 0 -nosalt -nopad

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

Sidebar

Related Questions

Hope I'm asking this correctly: I have a project Projects.Client I have my class
hope someone can help. I have two tables: Users -UserID -UserName UsersType -UserTypeID -UserID
This loop help get some text data from web service: while True: u =
I hope anyone from the large community here can help me write the simplest
I'm very new to RoR, moving from PHP. I have what I hope is
I hope someone here can help me see where this error is coming from.
I have Kohana ORM/Mysql query problem. I hope you can help. To start of,
Hope to get solution to this problem. I have been stuck on it since
Hope you are fine. I have to make a Web Project (very simple) I
The question seems settled, beaten to death even. Smart people have said smart things

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.