Close Menu
  • Business
    • Market Place
  • Devices & Gadgets
    • Buyers Guide
    • Trending
    • Social
  • Mobile & Telecoms
    • Broadband
  • Innovations
    • APPS
    • Start-ups
    • Software
    • AI ( artificial intelligence)
    • Auto-Tech
  • Health
    • Security
  • State
    • NCC
    • NiRA and .ng
    • NITDA
  • i-Sports
    • i-tertainment/Gaming
    • I-TV/Podcast
  • Reviews
    • Opinion
    • Special Report
    • Editorial and Analysis
  • Others
    • Events
    • Archive
    • Interviews
Facebook X (Twitter) Instagram
Latest
  • KongaPay Raises the Bar with Three ISO Certifications
  • SeerBit, Spectranet Launch ExpressPay to Revolutionise Internet Subscription Payments
  • Zinox Group’s Vision for Empowering 10,000 Women in Tech
  • FBNQuest Hosts Estate Planning Summit
  • TD Africa’s TecHERdemy churns out 400 female graduands
  • PAFON 2.0: Experts Highlight Ingredients for Accelerated Financial Inclusion in Nigeria
  • Starlink Gen 3 Kit Revolutionizes Satellite Internet in Nigeria
  • NITDA calls for public inputs on Digital Public Infrastructure document
Facebook X (Twitter) Instagram YouTube LinkedIn
IT NEWS NIGERIAIT NEWS NIGERIA
Subscribe Now
  • Business
    • Market Place
  • Devices & Gadgets
    • Buyers Guide
    • Trending
    • Social
  • Mobile & Telecoms
    • Broadband
  • Innovations
    • APPS
    • Start-ups
    • Software
    • AI ( artificial intelligence)
    • Auto-Tech
  • Health
    • Security
  • State
    • NCC
    • NiRA and .ng
    • NITDA
  • i-Sports
    • i-tertainment/Gaming
    • I-TV/Podcast
  • Reviews
    • Opinion
    • Special Report
    • Editorial and Analysis
  • Others
    • Events
    • Archive
    • Interviews
IT NEWS NIGERIAIT NEWS NIGERIA
Home»Opinion»Data Encryption in iOS using AES
Opinion

Data Encryption in iOS using AES

IT NEWS NIGERIABy IT NEWS NIGERIAFebruary 10, 2018No Comments3 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr WhatsApp VKontakte Email
Share
Facebook Twitter LinkedIn Pinterest Email

Article by: Ehioze Iweka

Advertisement

Data encryption is one of the ways of ensuring that data from your App is transported securely for processing via a service. I will be shedding a little light on data encryption using AES algorithm for anyone interested in encrypting data sent from their mobile application.

What is AES Encryption?

The Advanced Encryption Standard (AES), also known by its original name Rijndael, is a specification for the encryption of electronic data established by the U.S. National Institute of Standards and Technology (NIST) in 2001.[4]. Read more here.

How is AES Encryption Performed

Performing AES encryption in iOS is quite straight forward depending on the the encryption mode. There are basically two modes: ECB (Electronic Code Block) and CBC (Cipher Block Chaining). The major difference is that the CBC makes use of an initialization vector while the ECB does not. To perform encryption in the CBC mode, the following are required:
1. Secret Key: This is a randomly generated 16,24,or 32 digit key which must be used for both the encryption and decryption purposes. This key can be in base64 format or plain text depending on what’s best for you, but the rule is whatever format is used for encryption has to be the same format used for decryption, in other to get the same result.
2. Initialization Vector: This is a randomly generated 16 digit string, numeric or alphanumeric value used in the case of a CBC encryption
3.The text or data to be encrypted. As observed, the item for encryption can be a text string, a data or even an image data.
Assuming we already have our Secret Key defined in any format discussed above, lets proceed to generate our initialization vector. Below is a class method that randomly generates an initialization vector, of any specified length, and returns the result as a base64 encoded string.

Initialization vector generation
with the generated Initialization Vector(IV) and Secret Key you can now AES encrypt and decrypt your data in the following ways:

encrypting and decrypting method
You will need to add the AQToolKit third party library to your project, which is where the encryption algorithm is written, to avoid errors when you build your project.
Finally you have to implement the getKey and getIV methods used in your encrypt and decrypt method above. These methods just ensures that your IV and KEY are sent to the encryption method as a Data and not String. I have added the snippets below too:

 

You can convert your encrypted or decrypted data to base64 format using this code snippet:

where encrypted is the result from your encryption by the encrypt method above.

CONCLUSION

Data encryption using AES algorithm is very easy to implement if only the rules are followed when doing it. I hope this helps someone out there. Feel free to drop comments, and get across to me, for further clarification or assistance.
Ehioze Iweka
Email iehioze@gmail.com,
Twitter (ehis_iweka)
LinkedIn: www.linkedin.com/in/ehiozeiweka

 

 

Post Views: 147
Share. Facebook Twitter Pinterest LinkedIn Tumblr WhatsApp Email
Previous ArticleNCC Berths 91st Consumer Outreach Programme In Mangu, Plateau State
Next Article Opeke, Coker, Nnamani To Brainstorm @NITRA Breakfast Meeting
IT NEWS NIGERIA

Related Posts

6 Mins Read

MTN Board: Between sentiment and the law

March 16, 2025
5 Mins Read

Zinox demands apology from Femi Falana SAN over alleged defamation, reputational damage

January 7, 2025
16 Mins Read

Corporate Blackmail, My Story as a Case Study, by Leo Stan Ekeh, Chairman Zinox Group

December 26, 2024
3 Mins Read

South-West Nigeria Event: Journalists Explore the Future of AI in Journalism

November 5, 2024
Leave A Reply Cancel Reply

About Us
IT NEWS NIGERIA (www.itnewsnigeria.ng) is an on-line platform aimed at enriching Nigeria and Africa content in the cyberspace.

We believe the future is online.
Popular Updates

Design Bootcamps vs Self-Taught, A product designer’s perspective

March 22, 2024

How to get N100,000 loan @3% at Zenith Bank and other services

November 12, 2020

Interview: From Start-ups to Big Brands: Growth Marketing Strategies that work by Oluwasekemi Akinbo

May 18, 2023

Subscribe to Updates

Get the latest tech news & updates from IT NEWS NIGERIA

Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
  • About Us
  • Privacy Policy
  • Terms of Service
  • Advertise With Us
  • Contact Us
© 2025 IT NEWS NIGERIA.

Type above and press Enter to search. Press Esc to cancel.

Signup to our Newsletter