Skip to content

PrivateKey.fromWif not support compressed WIF format #16

Description

@zhjjj

It seems that PrivateKey.fromWif doesn't support WIF with compressed format.
When I use a WIF private key with compressed format, some warning shows up:
WARN: Expecting 32 bytes, instead got 33, stack trace: Error
And I can get a result from the function. However, the result is not correct.

So I read the souce code. PrivateKey.fromWif will generate a BigInteger from buffer generated from WIF format. So if I provide a compressed WIF which has an extra compressed flag byte, it will use the 33 bytes data to generate the private key. But it is not my original private key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions