Home News Forum Social Networking Support Us Advertise

Spanish Lesson 1 ($1.99)

aWake!Gently ($1.99)

The Bird & The Snail - Knock Knock - Deluxe ($4.99)

Match-It Trains ($0.99)

Tangled ($0.99)

iFlatter ($0.99)

The 15 puzzle ($0.99)

Tap Forms Database ($8.99)

Higher or Lower Card Game (Hi Lo) ($0.99)

Red Pixel ($0.99)

Time-Shift Radio ($0.99)

Want your application advertised here? Only $10/week!

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

Reply
 
LinkBack Thread Tools Display Modes
Old 12-04-2008, 09:54 AM   #1 (permalink)
Tylenol is my friend
 
Join Date: Oct 2008
Location: Midwest
Posts: 140
Rep Power: 1
Fontano is on a distinguished road
Default Help with CommonCrypto CCCrypt and 3DES

I have a requirement that I have to decode and encode a string value with the 3DES algorithm.

Common Crypto which is part of the SDK, appears to have support for 3DES.
However, the documentation about the library is limited and google searches have only come up with limited information.

The one that I found, that I have been using as a base is this one:
Apple - Support - Discussions - Problems with CommonCrypto ...

Over the last few months I have gotten significantly better with Objective-C and this enviornment; I can read the code and understand most of what it is doing. However my attempts to tweek this version to work with 3DES and get the output I need, isn't working.

Anyone out there that can help me the last few inches?

Here is my current code with KEY, INPUT, and what I am looking for in an output:
Code:
	NSString *dateString = @"2008-11-24 13:14:17.231";
	NSString *sigKey = @"70-248-56-157-134-203-200-22-28-236-253-93-112-161-200-174-164-211-234-22-208-162-13-13";
	NSArray *sigKeyArray = [sigKey componentsSeparatedByString:@"-"];
	NSString *outVal = @"55-9-145-188-46-202-54-193-31-157-143-148-122-3-194-114-10-242-34-120-142-247-127-10";
	
	CCCryptorStatus ccStatus;
	uint8_t *bufferPtr = NULL;
	size_t bufferPtrSize = 0;
	size_t movedBytes = 0;
	size_t plainTextBufferSize = [dateString length];
	//uint8_t *iv = NULL; //kCCBlockSize3DES;
	
	bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1);
	bufferPtr = malloc(bufferPtrSize * sizeof(uint8_t));
	memset((void *)bufferPtr, 0x0, bufferPtrSize);
//	memset((void *)iv, 0x0, 0);

	ccStatus = 	CCCrypt(
						kCCEncrypt,
						kCCAlgorithm3DES,
						kCCOptionPKCS7Padding,
						sigKeyArray,
						kCCKeySize3DES,
						nil,
						dateString,
						plainTextBufferSize,
						(void *)bufferPtr,
						bufferPtrSize,
						&movedBytes);
Any help, or even links to another example or a more detailed doc on how to use the library would be greatly appriciated.
__________________
-----
-) No matter what forum you join, you always start as a newbie. Even if you own the board.
-) There is no stupid question, if you think it is stupid don't answer it and it will fall of the screen
-) If you post some helpful solution, then that could lead to more helpful solutions. Soon, it is a chain reaction and then the forum becomes a monumental programming resource.
Fontano is offline   Reply With Quote
Reply

Bookmarks

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: 183
11 members and 172 guests
Alexman, atsd, BostonMerlin, comtek, lepetitapps, Neverever, P-atr1k, Raphy, Slecorne, Stitch, _mubashir
Most users ever online was 779, 05-11-2009 at 09:55 AM.
» Stats
Members: 8,172
Threads: 20,132
Posts: 89,979
Top Poster: RickMaddy (2,121)
Welcome to our newest member, juicysen
Powered by vBadvanced CMPS v3.1.0

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