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

Incorrect CK_VERSION string value #222

Open
AlexSynakh opened this issue Mar 30, 2023 · 0 comments
Open

Incorrect CK_VERSION string value #222

AlexSynakh opened this issue Mar 30, 2023 · 0 comments

Comments

@AlexSynakh
Copy link

AlexSynakh commented Mar 30, 2023

Hi, it seems that CK_VERSION.ToString method is returning incorrect value.

I'm currently using Pkcs11Interop 5.1.2 library and it is returning FirmwareVersion = 7.2 instead of FirmwareVersion = 7.02.
According to PKCS#11 v2.40 section 3.1, minor version number is the hundredth portion of the version. Provided example in PKCS#11 specification shows that CK_VERSION { major = 2, minor = 1 } is 2.01 version

So, in order to correctly display version string, CK_VERSION.ToString method implementation should be something like this:

public override string ToString()
{
    if (Minor[0] == 0) 
    {
        return string.Format("{0}.{1}", Major[0], Minor[0]);
    }

    return string.Format("{0}.{1:D2}", Major[0], Minor[0]);
}
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

1 participant