||Thread Tools||Search this Thread||Display Modes|
|Aug 26, 2008, 03:58 PM||#1|
problems using SecKeyEncrypt
I'm starting to work with cryptography on the iphone...
at the moment I'm trying to simply encrypt (and later decrypt a string) but ..when I run the app (on the device, an iphone) i get this message: "Program received signal: “EXC_BAD_ACCESS”."
which should mean...possibly problems with memory management right?
here the incriminated part of code:
uint8_t *pPlainText = (uint8_t*)"This is a test";
size_t *iCipherLength = (size_t*)"1024";
status = SecKeyEncrypt( public, kSecPaddingNone, pPlainText,strlen( (char*)pPlainText ) + 1, aCipherText,iCipherLength );
public is a SecKeyRef containing the public key
|Aug 26, 2008, 04:18 PM||#2|
Glancing at the documentation, aCipherText should be allocated first, and iCipherLength shouldn't be a string. It needs to be a number. Here's an attempt at fixing it (not tested):
uint8_t *pPlainText = (uint8_t*)"This is a test"; uint8_t aCipherText; size_t iCipherLength = 1024; status = SecKeyEncrypt(public, kSecPaddingNone, pPlainText, strlen( (char*)pPlainText ) + 1, aCipherText, &iCipherLength);
|Aug 26, 2008, 06:17 PM||#3|
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|iPad Mini: Wi-Fi Problems||grizzlyedwin||iPad||1||Jan 1, 2014 10:40 PM|
|RMBP 15" - Problems problems and more problems||rmwebs||MacBook Pro||14||Sep 30, 2013 04:22 AM|
|Anyone else having problems with 10.8.1?||Benbikeman||OS X 10.8 Mountain Lion||12||Sep 1, 2012 11:04 AM|
|Got problems! please help||Freebiscuits3||MacBook Pro||2||Aug 11, 2012 01:59 PM|
All times are GMT -5. The time now is 05:42 PM.