Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable verify #216

Open
murugesanmadappan opened this issue Aug 14, 2024 · 1 comment
Open

Unable verify #216

murugesanmadappan opened this issue Aug 14, 2024 · 1 comment

Comments

@murugesanmadappan
Copy link

murugesanmadappan commented Aug 14, 2024

This is my code while verifying error

Error: ERROR - Error verifying the message: Malformed public key

My Code

`import logging
from hsslms import HSS_Priv, LMS_ALGORITHM_TYPE, LMOTS_ALGORITHM_TYPE

def main():
# Define the LMS and LMOTS algorithm types
lms_type = LMS_ALGORITHM_TYPE.LMS_SHA256_M24_H15
lmots_type = LMOTS_ALGORITHM_TYPE.LMOTS_SHA256_N32_W1

# Initialize the HSS private key
logging.info("Initializing HSS private key with LMS and LMOTS algorithm types.")
hss_private_key = HSS_Priv([lms_type]*2, lmots_type)
logging.debug("HSS private key initialized.")

# message to sign
message = b"This is a Muru Secret message."
logging.info("Message to be signed: %s", message)

# Sign the message
logging.info("Signing the message.")
try:
    signature = hss_private_key.sign(message)
    logging.debug("Signature generated: %s", signature)
except Exception as e:
    logging.error("Error signing the message: %s", e)
    return

# Verify the message
logging.info("Verifying the message.")
try:
    # Initialize the HSS public key
    # Ensure that the public key is correctly created or loaded
    try:
        hss_public_key = hss_private_key.gen_pub()
        logging.debug("HSS public key initialized.")
    except Exception as e:
        logging.error("Error initializing HSS public key: %s", e)
        return

    # Perform verification
    is_valid = hss_public_key.verify(message, signature)
    logging.info("Verification result: %s", is_valid)
except Exception as e: logging.error("Error verifying the message: %s", e)

if name == "main":
main()`

@dmtucker
Copy link
Contributor

That code does not seem related to this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants