Crypto API working with padding

Have got a technical question regarding the development for bada platform? Share it with us!

Crypto API working with padding

Postby remy_david » Tue Mar 09, 2010 11:59 am

Hello,

I got an error while trying to encrypt data using ISymmetricCipher Interface (DES/AES cipher) enabling CBC padding scheme.

Code: Select all
ByteBuffer* input; // the input data, data length != cipher length, needs padding
ByteBuffer *pOutput = null;
DesCipher *pCipher;
pCipher = new DesCipher();
pCipher->Construct("CBC/RFC2630"); // RFC2630 is the only available padding scheme from the Crypto API

// set IV, Key, etc...

pOutput = pCipher->EncryptN(*input); // returns null
if (pOutput == null)
{
   // error !
}


Exception raised: E_UNSUPPORTED_OPERATION (which souldn't be raised by Osp::Security::Crypto::ISymmetricCipher::EncryptN according to the API documentation).

Internal error message in console:
"0045.902,EXCEPTION,03,90,Osp::Security::Crypto::__SymmetricCipherPi::__DoCipherN (361) > [FSecurity Exception]:(res == noError): Check this!!!!!"

Notice the "Check this!!!!!" :shock:
I guess it's because the SDK is still a beta release...

Using "CBC/NOPADDING" with data length multiple of cipher block length works well though.

I guess I will need to implement my own C++ padding function, do somebody know one in the public domain (PKCS5 implementation would be great) ?
Need more hands, one for each mobile platform out there...
User avatar
remy_david
Moderator & Author
 
Posts: 368
Joined: Thu Feb 25, 2010 9:29 am
Location: France

Re: Crypto API working with padding

Postby wit » Tue Mar 09, 2010 12:05 pm

You have RC4, right?
If I remember it right a bunch of stuff from Osp::Security was not supported... check the Release Notes, maybe you can find your answer there?
Wit. Pirate. 해적

:pirate-cool:
BadaDev

Image
User avatar
wit
Founder
 
Posts: 931
Joined: Wed Nov 25, 2009 8:17 am
Location: Germany

Re: Crypto API working with padding

Postby remy_david » Tue Mar 09, 2010 1:48 pm

Yes I got RC4, and that's not mentionned in the Release Notes but you are probably right. I just write my PKCS5 padding implementation so I will use that until final SDK release and then I will try again the one from Crypto API and tell you what ;)
Need more hands, one for each mobile platform out there...
User avatar
remy_david
Moderator & Author
 
Posts: 368
Joined: Thu Feb 25, 2010 9:29 am
Location: France


Return to Help Requests

Who is online

Users browsing this forum: No registered users and 7 guests