[aerogear-dev] iOS Crypto questions
Corinne Krych
corinnekrych at gmail.com
Fri Oct 18 10:56:24 EDT 2013
Hello All
I've just updated the crypto iOS API documentation
https://github.com/corinnekrych/aerogear.org/blob/77ab01e16bd385c7d8a507dfb4b0a6838c4d6c13/docs/specs/aerogear-crypto.md#api-draft-0-2
I would like to discuss with you the actual symmetric encryption method in the API. Atm, we have:
=> Java:
cryptoBox.encrypt(IV, message);
=> objective-C
NSData* encryptedData = [cryptoBox encrypt:dataToEncrypt IV:encryptionSalt];
=> JavaScript
AeroGear.encrypt( options );
I think JavaScript grouping everything (key, IV, data to encrypt) in options is not the best approach but I like the encrypt method with only one argument. I rather have options containing key/IV information and have a separate method encrypt that takes the message to encrypt.
Something like:
=> Java:
CryptoBox cryptoBox = new CryptoBox(new PrivateKey(SOME_SECRET_KEY), IV);
cryptoBox.encrypt(message);
=> objective-C
cryptoBox = [[AGCryptoBox alloc] initWithKey:key salt:encryptionSalt initializationVector:vector]];
NSData* encryptedData = [cryptoBox encrypt:dataToEncrypt];
=> JavaScript
var options = {
IV: superRandomInitializationVector,
AAD: "whateverAuthenticatedData",
key: generatedKey
};
AeroGear.setOptions(options);
AeroGear.encrypt(message);
wdyt?
Corinne
On Oct 18, 2013, at 2:28 PM, Christos Vasilakis <cvasilak at gmail.com> wrote:
> Hi,
>
> during the ongoing work of adding symmetric crypto interface in iOS[1] we came up with two issues:
>
> - we noticed that in the Java impl of the ‘encrypt’ method[2] the IV is passed as a parameter. Not sure but is this done for a reason? Can’t this be passed as a parameter in the constructor and simplify the invoke of just ‘encrypt:data’ ?
>
> - the ‘validate’ method[3] in Pbkdf2 class is used from what we have seen mostly in tests, is there a reason from being part in the class signature?
>
>
> Thanks,
> Christos
>
> [1] https://github.com/aerogear/aerogear-crypto-ios/pull/1
> [2] https://github.com/aerogear/aerogear-crypto-java/blob/master/src/main/java/org/jboss/aerogear/crypto/CryptoBox.java#L106
> [3] https://github.com/aerogear/aerogear-crypto-java/blob/master/src/main/java/org/jboss/aerogear/crypto/password/Pbkdf2.java#L73
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
More information about the aerogear-dev
mailing list