hohl / MIHCrypto

OpenSSL wrapper for Objective-C [cryptography]
MIT License
340 stars 68 forks source link

Add signWithSHA128:error: and verifySignatureWithSHA128:message: #12

Closed akhilstanis closed 10 years ago

akhilstanis commented 10 years ago

Needed to sign some data using SHA1 hashing, but it was not implemented :( I have added two methods to sign and verify on MIHRSAPrivateKey and MIHRSAPublicKey which uses SHA1 hashing.

- (BOOL)verifySignatureWithSHA128:(NSData *)signature message:(NSData *)message;
- (NSData *)signWithSHA128:(NSData *)message error:(NSError **)error;
hohl commented 10 years ago

Well done. In fact we would need to split up verfiy/sign and the signature process. Passing the signature method as parameter would be the correct way. But for the first step I accepted your pull request. Thank you for your support.

akhilstanis commented 10 years ago

Yes, ideally that is the pattern normally followed I guess. Also it will be great to have a raw sign method which takes already hashed data as argument. eg.

-(NSData ) rawSign:(NSData )hashedMessage error:(NSError )error

Kind of useful in not so common situations.