1
unsigned char *prime;
unsigned char *keyPeer;
unsigned char *generator = [self.client readBytesWithLength:2];

unsigned char *keyLengthRaw = [self.client readBytesWithLength:2];
int keyLength = keyLengthRaw[0]*256+keyLengthRaw[1];

prime = [self.client readBytesWithLength:keyLength];
keyPeer = [self.client readBytesWithLength:keyLength];

NSLog(@"key length %d",keyLength);
NSLog(@"---generator: %d", (int) generator[0]*256+generator[1]);
NSLog(@"---prime:");
NSLog([NSString stringWithCString:prime encoding:NSASCIIStringEncoding]);
NSLog(@"---peerkey:");
NSLog([NSString stringWithCString:keyPeer encoding:NSASCIIStringEncoding]);

この後、dh 公開鍵と共有秘密鍵を生成するにはどうすればよいですか?

4

0 に答える 0