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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:19:40+00:00 2026-06-02T22:19:40+00:00

I am trying to encrypt a string with AES 128 encryption, using CBC mode,

  • 0

I am trying to encrypt a string with AES 128 encryption, using CBC mode, with Zero Padding. Sadly, i do not know how to do this, as many attempts have gone unsuccessful. I have code in C# and was wondering whether anyone can help me getting my encryption working.
the code:

`using System;
using System.Security.Cryptography;
using System.Text;
using System.IO;

byte[] request = UTF8Encoding.UTF8.GetBytes("{string which needs encrypting}");

byte[] key = UTF8Encoding.UTF8.GetBytes("{key}");
byte[] iv = UTF8Encoding.UTF8.GetBytes("{iv}");

AesCryptoServiceProvider aes = new AesCryptoServiceProvider();

aes.Key = key;
aes.IV = iv;


aes.Mode = CipherMode.CBC;

aes.Padding = PaddingMode.Zeros;

ICryptoTransform cTransform = aes.CreateEncryptor();

byte[] result = cTransform.TransformFinalBlock(request, 0, request.Length);

aes.Clear()

string encryptedRequest = Convert.ToBase64String(result, 0, result.Length);`

ive looked a common crypto, but i cannot see an option to CBC mode [i dont know cccrypto much anyways, maybe i overlook?]
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-02T22:19:41+00:00Added an answer on June 2, 2026 at 10:19 pm

    The Method in CommonCrypto.m

    - (NSData *) dataEncryptedUsingAlgorithm: (CCAlgorithm) algorithm
                                     key: (id) key
                    initializationVector: (id) iv
                                 options: (CCOptions) options
                                   error: (CCCryptorStatus *) error
    

    iv parameter declaration

    @param      iv              Initialization vector, optional. Used for 
                                Cipher Block Chaining (CBC) mode. If present, 
                                must be the same length as the selected 
                                algorithm's block size. If CBC mode is
                                selected (by the absence of any mode bits in 
                                the options flags) and no IV is present, a 
                                NULL (all zeroes) IV will be used. This is 
                                ignored if ECB mode is used or if a stream 
                                cipher algorithm is selected. 
    

    so , you could pass nil value to iv parameter

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

Sidebar

Related Questions

I'm trying to encrypt/decrypt a string using 128 bit AES encryption (ECB). What I
I am trying to write encrypt/decrypt methods for AES 256 CBC encryption using PKCS5Padding
I am trying to encrypt/decrypt a string using eith Rijndael or Aes and the
I'm trying to encrypt a string, 50-150 characters long, with AES in a mode
Here are my requirements: I need to encrypt a string in PHP using AES
I'm trying to encrypt/decrypt files with PBE using AES. I'm using Bouncy Casle library(lightweight
I'm trying to encrypt a string on Android with AES. The symmetric key is
I'm trying to encrypt and decrypt files with C++, using this code: #include <iostream>
I'm trying to set up 128 bit AES encryption, and I'm getting an exception
I'm trying to understand how encryption using the CTR mode works, so I created

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.