Skip to content

XMSS raw_private_key() does not return correct number of bytes #4952

@ChristianC244

Description

@ChristianC244

Good day,
I'm using XMSS in a simple test for signature generation and I wanted to save the byte array of the secret key for testing/researching purpouses.
The PrivateKey class has a function raw_private_key() that returns a custom format different from the one in the RFC which makes sense. The problem is that by documentation of the function it says that it should return 12 + 4n bytes. I'm testing with XMSS_SHA2_10_256 and XMSS_SHAKE_10_256 and I was expecting 140B, yet I only get 137.
I'm using such function because, from PrivateKey documentation, if I want to recreate the object i need to pass such key in the constructor.

The test code is this simple script:

auto params = Botan::XMSS_Parameters::XMSS_SHA2_10_256;
auto rng = Botan::System_RNG();
Botan::XMSS_PrivateKey private_key(params, rng);
std::vector<uint8_t> sk = unlock(private_key.raw_private_key()); // here sk len is 137B

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions