oleganza / CoreBitcoin

Awesome Bitcoin toolkit for ObjC and Swift
Do What The F*ck You Want To Public License
719 stars 255 forks source link

BTCKey signatureForMessage, unable to verify signature in other frameworks #82

Open mandelmonkey opened 8 years ago

mandelmonkey commented 8 years ago

I Can verify a signature for message in corebitcoin but when I try to verify the signature in other frameworks such as bitcoin.j the signature is not valid, what is the correct way to get the signature as a string?

BTCKey * newKey = [[BTCKey alloc] init];

NSData * sig  = [newKey signatureForMessage:@"hello world"];

NSLog(@"sig:%@",sig.base58String);
NSLog(@"sig:%@",sig.BTCHash256.hex);
NSLog(@"sig:%@",sig.hex);

if([newKey isValidSignature:sig forMessage:@"hello world"]){
    NSLog(@"valid");
}
else{
    NSLog(@"not valid");
}