Closed yuval-netanel closed 9 years ago
Thats quite strange. Your code snippet seems okay. Any functionality of MIHRSAKeyFactory
should become automatically tested in MIHRSAKeyFactoryTests
, so there shouldn't be any issues with it (since all tests run without problems, tested locally on my machine and on Travis continuos integration server).
I'm sorry, but I guess I can't help you.
@hohl I have same issue. I found that reason of it is wrong encoding of NSData that return method
[keyPair.public dataValue];
I think that this issue and this issue is same.
You mean, using NSDataBase64DecodingIgnoreUnknownCharacters
fixes this issue?
For fixing this issue change method
- (NSString *)description
{
return [[NSString alloc] initWithData:[self dataValue] encoding:NSUTF8StringEncoding];
}
to
- (NSString *)description
{
return [[self dataValue] base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
}
in MIHRSAPublicKey.m
I am sorry. It just looks like similar bugs. Everything working for me without NSDataBase64DecodingIgnoreUnknownCharacters
description
is for debugging anyway. However I thought this issue is about not being able to generate public keys? If it's about the description
output I may need to have second look at it.
Sorry if it wasn't clear, but it's about the description
output.
Oh dear. Since the description
field has been added for testing purposes I've forgotten about the unit tests for, I'm sorry.
I'll fix it immeditley, this should do the job:
- (NSString *)description
{
return [[self dataValue] MIH_base64EncodedString];
}
I want to send the public key to the server. This is how I tried to get the public key string, but it returns null:
Any suggestions?