Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-23-2011, 06:46 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 84
prathibha is on a distinguished road
Thumbs up rsa algorithm parameter

HI,
i am using the encryption technique, in that i am using both symmetric and asymmetric algorithm its working fine , but in asymmetric algorithm i am generating the key using getpublickeyref() but i want to pass the key and then encrypt... can anyone tell how i can do?please
prathibha is offline   Reply With Quote
Old 08-23-2011, 07:04 AM   #2 (permalink)
Registered Member
 
manojb's Avatar
 
Join Date: Jan 2011
Posts: 263
manojb is on a distinguished road
Post

Quote:
Originally Posted by prathibha View Post
HI,
i am using the encryption technique, in that i am using both symmetric and asymmetric algorithm its working fine , but in asymmetric algorithm i am generating the key using getpublickeyref() but i want to pass the key and then encrypt... can anyone tell how i can do?please
seems you have to write some other method that accepts this key as input and then return the encrypted code... I don't think we have any pre-compiled code for this purpose!
__________________
U can not fail, until U Quit...

Manoj B
manojb is offline   Reply With Quote
Old 08-23-2011, 07:44 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 84
prathibha is on a distinguished road
Thumbs up

Quote:
Originally Posted by manojb View Post
seems you have to write some other method that accepts this key as input and then return the encrypted code... I don't think we have any pre-compiled code for this purpose!

thanks for the reply manoj, i will try i am using this method for encryption here can u tell me where i can explictily add the key

my code is as follow:

this is the encryption method where the parameters are plaintext and cipther text

OSStatus status = noErr;


size_t plainBufferSize = strle(char *plainBuffer);
size_t cipherBufferSize = CIPHER_BUFFER_SIZE;

// Error handling
// Encrypt using the public.
status = SecKeyEncrypt([self getPublicKeyRef],
PADDING,
plainBuffer,
plainBufferSize,
&cipherBuffer[0],
&cipherBufferSize
);



}


- (SecKeyRef)getPublicKeyRef {
OSStatus resultCode = noErr;
SecKeyRef publicKeyReference = NULL;

if(publicKey == NULL) {
NSMutableDictionary * queryPublicKey = [[NSMutableDictionary alloc] init];

// Set the public key query dictionary.
[queryPublicKey setObject (id)kSecClassKey forKeyid)kSecClass];
[queryPublicKey setObject publicTag forKeyid)kSecAttrApplicationTag];
[queryPublicKey setObject (id)kSecAttrKeyTypeRSA forKeyid)kSecAttrKeyType];
[queryPublicKey setObject [NSNumber numberWithBool:YES] forKeyid)kSecReturnRef];

// Get the key.
resultCode = SecItemCopyMatching((CFDictionaryRef)queryPublicKe y, (CFTypeRef *)&publicKeyReference);

if(resultCode != noErr)
{
publicKeyReference = NULL;
}

[queryPublicKey release];
} else {
publicKeyReference = publicKey;
}


return publicKeyReference;
}
prathibha is offline   Reply With Quote
Old 08-23-2011, 09:00 AM   #4 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Boston, MA
Posts: 135
carbonbasednerd is on a distinguished road
Default

Not sure if this would help you out

man page CCCrypt section 3
carbonbasednerd is offline   Reply With Quote
Old 08-25-2011, 01:48 AM   #5 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 84
prathibha is on a distinguished road
Thumbs up

Quote:
Originally Posted by carbonbasednerd View Post
Not sure if this would help you out

man page CCCrypt section 3
i tried with mycrypto example but which is not working throwing error... please can anybody help me in this?
prathibha is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, objective c

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 400
13 members and 387 guests
7twenty7, cristofercolmbos, dedeys78, fiftysixty, gmarro, iOS.Lover, jonathandeknudt, Matrix23, raymng, stanny, tymex, UMAD, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:13 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0