Skip to content

Commit

Permalink
added workaround to use UNCOMPRESSED private keys when calculating th…
Browse files Browse the repository at this point in the history
…e public key for use as a bitcoin address.
  • Loading branch information
notespace committed Dec 5, 2012
1 parent 859b536 commit 736235a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/address.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GString *bp_pubkey_get_address(struct bp_key *key, unsigned char addrtype)
void *pubkey = NULL;
size_t pk_len = 0;

bp_pubkey_get(key, &pubkey, &pk_len);
bp_pubkey_get_uncompressed(key, &pubkey, &pk_len);

unsigned char md160[RIPEMD160_DIGEST_LENGTH];

Expand Down
8 changes: 8 additions & 0 deletions lib/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ bool bp_pubkey_get(struct bp_key *key, void **pubkey, size_t *pk_len)
return true;
}


bool bp_pubkey_get_uncompressed(struct bp_key *key, void **pubkey, size_t *pk_len){
bool ret;
EC_KEY_set_conv_form(key->k, POINT_CONVERSION_UNCOMPRESSED);
ret = bp_pubkey_get(key, pubkey, pk_len);
EC_KEY_set_conv_form(key->k, POINT_CONVERSION_COMPRESSED);
}

bool bp_key_secret_get(void *p, size_t len, const struct bp_key *key)
{
if (!p || len < 32 || !key)
Expand Down

0 comments on commit 736235a

Please sign in to comment.