hohl / MIHCrypto

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

Help with RSA signature #34

Closed Aleph72 closed 8 years ago

Aleph72 commented 8 years ago

Hello, I'm using this framework to generate the key pair and sign a message. I'm creating the key pair with: self.rsaKeyFactory = [[MIHRSAKeyFactory alloc] init]; self.rsaKeyFactory.preferedKeySize = MIHRSAKey1024; self.keyPair = [self.rsaKeyFactory generateKeyPair];

and then sign with:

For what I know, signing with a 1024 private key should give a 128byte signature, but I get just 86 bytes. I've been told to generate a 128 bytes signature, so any help would be really apreciated.

Thanks.

Aleph72 commented 8 years ago

I'll answer myself this time. The problem was the line "NSString *signString = [signatureData MIH_base64EncodedString];" signatureData is exactly 128 byte, so I changed the method to return directly the NSData instead of converting it back to a NSString.