Comments (4)
Not working for me for iOS as well. It gives too many errors.
from cross-platform-aes-encryption.
@i5kender @MVakas I had tested all the code provided in this library. Unfortunately, I won't be able to help you with the information you have provided.
What are the errors which you are getting ? Can you create a gist which I can look at ?
from cross-platform-aes-encryption.
I have used https://github.com/benoitsan/BBAES classes for ios encrption. I have done. Thanks a lot navneet
from cross-platform-aes-encryption.
I am stuck somewhere in between, please help
This is the function I am using to decrypt in iOS
func aesCBCDecrypt(data: Data, keyData: Data) throws -> Data? {
let keyLength = keyData.count
let validKeyLengths = [kCCKeySizeAES128, kCCKeySizeAES192, kCCKeySizeAES256]
if validKeyLengths.contains(keyLength) == false {
throw AESError.KeyError(("Invalid key length", keyLength))
}
var numBytesDecrypted: size_t = 0
let options = CCOptions(kCCOptionPKCS7Padding)
let cryptLength = size_t(data.count)
var cryptData = Data(count: cryptLength)
let cryptStatus = cryptData.withUnsafeMutableBytes {cryptBytes in
data.withUnsafeBytes {dataBytes in
keyData.withUnsafeBytes {keyBytes in
CCCrypt(CCOperation(kCCDecrypt),
CCAlgorithm(kCCAlgorithmAES),
options,
keyBytes, keyLength + 1,
keyBytes,
dataBytes, data.count,
cryptBytes, cryptLength,
&numBytesDecrypted)
}
}
}
This is the function I am using to encrypt in .net
public string EncryptData(string textData, string Encryptionkey)
{
RijndaelManaged objrij = new RijndaelManaged
{
//set the mode for operation of the algorithm
Mode = CipherMode.CBC,
//set the padding mode used in the algorithm.
Padding = PaddingMode.PKCS7,
//set the size, in bits, for the secret key.
KeySize = 256,
//set the block size in bits for the cryptographic operation.
BlockSize = 128
};
//set the symmetric key that is used for encryption & decryption.
byte[] passBytes = Encoding.UTF8.GetBytes(Encryptionkey);
//set the initialization vector (IV) for the symmetric algorithm
byte[] EncryptionkeyBytes = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
//int len = passBytes.Length;
//if (len > EncryptionkeyBytes.Length)
//{
// len = EncryptionkeyBytes.Length;
//}
//Array.Copy(passBytes, EncryptionkeyBytes, len);
objrij.Key = passBytes;
objrij.IV = EncryptionkeyBytes;
//Creates symmetric AES object with the current key and initialization vector IV.
ICryptoTransform objtransform = objrij.CreateEncryptor();
byte[] textDataByte = Encoding.UTF8.GetBytes(textData);
//Final transform the test string.
return Convert.ToBase64String(objtransform.TransformFinalBlock(textDataByte, 0, textDataByte.Length));
}
I am not getting the expected output.
Input:
Plain text: dd00bd64-38d6-4d68-b0fc-2bc6389ee9b3
key: abcdef0123456789abcdef0123456789
Output:
\u{05}\u{06}ST\u{07}\u{02}\u{06}\u{05}\u{1F}\0\u{0C}Q\0\u{1A}\u{0C}]68-b0fc-2bc6389ee9b3
Any help is appreciated
from cross-platform-aes-encryption.
Related Issues (20)
- Encrypt in java and Decrypt in IOS - Not working HOT 1
- Decryption result getting null in IOS
- Encryption in c# is broken if string to encode contains non English characters (with fix)
- iOS Swift Problem HOT 2
- encryption and decryption error when I encrypt a long string with C#
- Not working in IOS. Please check before using. HOT 2
- How to implement encryption and decryption in PHP? HOT 1
- Encrypted string in C# and Decryption IOS vise versa not working
- Facing problem while decryption in iphone5
- Cancelled issue reporter's mistake
- string decryption failed in c# which encrypted in objective c
- Android encryption and decryption facing issue
- The key is not correctly converted to hex string in iOS 13 beta
- Add authentication
- How can i use it in Swift 5 or 4 HOT 1
- .Net Support
- Unable to decrypt my encrypted data. HOT 2
- Refactor - c#, android and web
- Request for a feature in Golang
- Cut big Sentence after Decrypt
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cross-platform-aes-encryption.