dev5tec / fbencryptor Goto Github PK
View Code? Open in Web Editor NEWEasy Encryption library (CCCrypt wrapper), AES 256bit support.
Easy Encryption library (CCCrypt wrapper), AES 256bit support.
when i am using a new encrypted code to decrypted then only one char string is showing with save key and iv
Hi. The readme states the following:
"Encrypt/decrypt plain text message with Base64 encoding"
Since when is Base64 considered encryption? It has absolutely nothing to do with encryption and relying on base64 for security purposes is just wrong.
in PHP , I do this to encrypt, but the encrypted string can not be decrypted with FBEncryptor.
Am I doing something wrong?
rtrim(
base64_encode(
mcrypt_encrypt(
MCRYPT_RIJNDAEL_256,
$sSecretKey, $sValue,
MCRYPT_MODE_ECB,
mcrypt_create_iv(
mcrypt_get_iv_size(
MCRYPT_RIJNDAEL_256,
MCRYPT_MODE_ECB
),
MCRYPT_RAND)
)
), "\0"
);
generateIv Method
+ (NSData*)generateIv
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
srand(time(NULL));
});
char cIv[FBENCRYPT_BLOCK_SIZE];
for (int i=0; i < FBENCRYPT_BLOCK_SIZE; i++) {
cIv[i] = rand() % 256;
}
return [NSData dataWithBytes:cIv length:FBENCRYPT_BLOCK_SIZE];
}
The warning...
FBEncryptorAES.m:156:15: Implicit conversion loses integer precision: 'time_t' (aka 'long') to 'unsigned int'
This happens only in iOS6.
I'm using [FBEncryptorAES decryptData: key: iv:] and everything decrypts fine in ios 5.1.1 and below.
But when i'm doing this in iOS6, my text seem to be truncated at random lengths.
Changed as you can see in these lines.
Is It Fine?
//
// base64EncodedString
//
// Creates an NSString object that contains the base 64 encoding of the
// receiver's data. Lines are broken at 64 characters long.
//
// returns an autoreleased NSString being the base 64 representation of the
// receiver.
//
(NSString *)base64EncodedString
{
size_t outputLength;
char *outputBuffer = NewBase64Encode([self bytes], [self length], true, &outputLength);
// Delete the Autorelease in ORIG
NSString *result = [[NSString alloc]
initWithBytes:outputBuffer
length:outputLength
encoding:NSASCIIStringEncoding];
free(outputBuffer);
return result;
}
// added by Hiroshi Hashiguchi
(NSString *)base64EncodedStringWithSeparateLines:(BOOL)separateLines
{
// ORIG size_t outputLength;
size_t outputLength = 0;
char *outputBuffer = NewBase64Encode([self bytes], [self length], separateLines, &outputLength);
// Delete the Autorelease in ORIG
NSString *result = [[NSString alloc]
initWithBytes:outputBuffer
length:outputLength
encoding:NSASCIIStringEncoding];
free(outputBuffer);
return result;
}
I want to decrypt the text by openssl command. Please help me.
I am using the following command but could not able to decrypt it:
$ openssl enc -d -aes256 -in text.txt -out decrypt.txt
I am getting bad magic number error.
It is working fine on IOS end but not working with openssl.
Very helpful encryption library for CCCrypt. Thank you for sharing. For certain strings decryption works but some times decryption fails and the error message I get is [ERROR] failed to decrypt| CCCryptoStatus: -4304. I haven't modified the configuration. Any ideas?
It’s been awesome, now I’m going to swift, don’t know if there is a swift version?
first i want to thank you for charing this lib.
I use FBEncryptor in one of my projects and it work fine but when i test in ios 6 the decrypt function always return "0" ( all good statue ), if i put the good password, the data returned after decrypt is good to, but with a wrong password, data is not nil and statue is "0".
I don't know if the wifi problem in ios 6 is the same as mine, because if users change on router to WPA2 TKIP from AES it work fine.
is this an issue in ios 6 or i can do something to test the file 'validity' after decrypt ?
its really an 'emergency' so thank you for help .
Hi,
As I'm testing your encryptor, the out put is not matched with http://aesencryption.net/.
We need to use AES 256 in both server side and the iOS app but I can not get the right out put for any data.
For ex:
NSString* encrypted = [FBEncryptorAES encryptBase64String:@"hello"
keyString:@"somekey"
separateLines:NO];
returns me: gCSyt7HUKZY/cUda3zcb4w==
but the http://aesencryption.net/ returns : i6PoffMYyd1ZLQSFl03DxWmIbD5dvOQRXLmjNnHmmjM=
As you both said the out puts are Base64 too.
Where is the problem? Please help me out.
Thanks.
Hi there,
Are you provide support for android also . if not then how can I use this library to fulfil my need in android also or if you can suggest me another other encryption library that work same as FBEncryptor then it is very helpful for me.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.