You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
- (NSString *)signMessageData:(NSData *)data withKey:(MIHRSAPrivateKey *)privKey {
NSError *signingError = nil;
NSData *signatureData = [privKey signWithSHA256:data error:&signingError];
if (signingError != nil) {
NSLog(@"Error al firmar el mensaje: %@", signingError.localizedDescription);
}
NSString *signString = [signatureData MIH_base64EncodedString];
return signString;
}
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.
The text was updated successfully, but these errors were encountered:
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.
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:
- (NSString *)signMessageData:(NSData *)data withKey:(MIHRSAPrivateKey *)privKey {
NSError *signingError = nil;
NSData *signatureData = [privKey signWithSHA256:data error:&signingError];
if (signingError != nil) {
NSLog(@"Error al firmar el mensaje: %@", signingError.localizedDescription);
}
NSString *signString = [signatureData MIH_base64EncodedString];
return signString;
}
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.
The text was updated successfully, but these errors were encountered: