Reputation: 21
I'm going to develop a multi-platform application (iOS and Android) and I need to encrypt some data with AES GCM. Can you please tell me what are the libraries for both platform to do this?
I know that there is CommonCrypt for iOS but I don't know if it support GCM.
Upvotes: 2
Views: 1780
Reputation: 2064
https://cocoapods.org/pods/themis
General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), Android (Java, Kotlin), desktop Java, С/С++, Node.js, Python, Ruby, PHP, Go, Rust, WASM.
Upvotes: 0
Reputation: 2005
You could look into Encryptor4j. It's a small library for simplifying common encryption tasks in Java and Android. As its author I can vow for its ease of use and simplicity:
String message = "This string has been encrypted & decrypted using AES in Galois Counter Mode";
SecretKey secretKey = KeyFactory.AES.randomKey();
Encryptor encryptor = new Encryptor(secretKey, "AES/GCM/NoPadding", 16, 128);
byte[] encrypted = encryptor.encrypt(message.getBytes());
Just add the following line to your build.gradle
file:
compile 'org.encryptor4j:encryptor4j:0.1.2'
Upvotes: 0
Reputation: 112865
Looking at the Common Crypto header GCM mode is not available. The closest is CTR (kCCModeCTR) but that would take some research to see if it is available for AES. Interestingly kCCModeCTR
does not have a @constant defined for it.
If you are just going to "encrypt some data", where data is not really a high speed communication stream just use CBC with PKCS7 Padding. If you need the authentication portion of GCM this won't meet your needs.
Upvotes: 0
Reputation: 288
Conceal https://github.com/facebook/conceal provides an API to encrypt data on android. It uses AES GCM under the hood
Upvotes: 2