joelhockey / jacknji11

Java Native Interface for PKCS#11
MIT License
32 stars 22 forks source link

Implement "instance" versions of C and CE classes (#44). Alternative implementation. #46

Closed Bragolgirith closed 2 years ago

Bragolgirith commented 2 years ago

As discussed in #44 - an alternative implementation of the proposed Ci and CEi classes that attempts to keeps backwards compatibility by delegating the business logic to the NC and NCE classes:

  1. Add new static methods that accept a NativeProvider instance (instead of relying on the public field).
  2. Have the original static methods delegate to the new static methods (and deprecate them).
  3. Add the new Ci class and have it also delegate to the new static methods.

The PR is not complete yet - notably not all Javadocs have been properly updated - but can be used as a starting point for discussion.

joelhockey commented 2 years ago

Thanks for the proposal. I have implemented something similar to this in https://github.com/joelhockey/jacknji11/pull/47. Would it work for what you require?

Bragolgirith commented 2 years ago

Yes, #47 does solve the multi-library access issue. 👍

With the the project version number bump and the new javadoc on the NATIVE field (that changes made after calling Initialize() will be ignored), I think it is no longer an issue that we are technically not fully backwards compatible.

Looking forward to having the pull request merged!