Skip to content

Occasional Exception in attributes.py to_byte_array() #41

@srl17

Description

@srl17

I am currently using PyCryptoki 2.5.23

I have an IV that the HSM randomly generates. I call other functions such as a mechanism. It eventually funnels down to to_byte_array().
Works great most of the time. It seems about 1 out 500,000 calls to the HSM I get some random byte string such as b'UvG;H&,TGi*2' which doesn't meet any of checks for a byte string. It thus tries the value as a Hex String val = int(val, 16) which it isn't and then a ValueError exception is thrown. On the current master branch this is occurring on line 305.

I added in my usage a check if all the values are Hex and if they are then I say val = int(val, 16) otherwise I assume it is a standard bytestring like in this check 'if "\x" in repr(val):'

Just wanted to let you know about this low rate exception issue I have seen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions