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

Add documentation on the Mozilla-JSS Provider #443

Merged
merged 2 commits into from
Apr 20, 2020

Conversation

cipherboy
Copy link
Member

@cipherboy cipherboy commented Mar 25, 2020

Signed-off-by: Alexander Scheel <ascheel@redhat.com>

This begins to document our changes w.r.t. JSSProviderLoader &c.

You can see the rendered documentation here.

@cipherboy cipherboy added the docs Changes related to documentation label Mar 25, 2020
@cipherboy cipherboy added this to the 4.6.4 milestone Mar 25, 2020
@cipherboy cipherboy self-assigned this Mar 25, 2020
@cipherboy
Copy link
Member Author

Discussion from #454 should be added here.

@cipherboy cipherboy changed the title [WIP] Add documentation on the Mozilla-JSS Provider Add documentation on the Mozilla-JSS Provider Apr 9, 2020
@cipherboy cipherboy requested a review from edewata April 9, 2020 17:44
Copy link
Contributor

@edewata edewata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at my comments below.

docs/usage/jssprovider.md Outdated Show resolved Hide resolved
docs/usage/jssprovider.md Outdated Show resolved Hide resolved
it. For more information, see the corresponding NSS documentation on these
values.

The following initialization values are supported:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These params are documented in javadoc. Should we just point to javadoc instead duplicating it here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I think that'd be better.

docs/usage/jssprovider.md Outdated Show resolved Hide resolved
docs/usage/jssprovider.md Outdated Show resolved Hide resolved
docs/usage/jssprovider.md Outdated Show resolved Hide resolved
`jss.cfg` takes the same `InitializationValues` parameters, except in a
properties file format.

### JSS Config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we actually need the jss. or nss. prefixes, but it's up to you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's other subtrees (ocsp being the deeper one); I think it makes sense then to have a separate jss and nss subtree. For reference, the nss.cfg used by OpenJDK is flat:

name = NSS
nssLibraryDirectory = /usr/lib64
nssDbMode = noDb
attributes = compatibility
handleStartupErrors = ignoreMultipleInitialisation

But they also use camelCase and prefix NSS-specific attributes with nss.

docs/usage/jssprovider.md Outdated Show resolved Hide resolved
Comment on lines 191 to 157
try {
cm = CryptoManager.getInstance();
} catch (NotInitializedException nie) {
CryptoManager.initialize(...);
cm = CryptoManager.getInstance();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it's necessary to tell people to change their code this way.
Theoretically people can continue to use the old API which will work
with the old and the new JSS:

CryptoManager.initialize(...);
CryptoManager cm = CryptoManager.getInstance();

Once they no longer need to support the old JSS they can simply drop
CryptoManager.initialize() and switch to java.security.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the section under java.security. Presumably, if they're using this code snippet, they'd prefer a java.security JSS instance over a CryptoManager instance. This describe a fallback when either JSS doesn't support java.security or JSS wasn't initialized that way.

I've added a comment saying they could throw this exception instead of catching it.

I don't think its reasonable to assume everyone is going to switch to java.security right away, and those that will, won't necessarily support it consistently.

docs/usage/jssprovider.md Outdated Show resolved Hide resolved
@cipherboy
Copy link
Member Author

@edewata I believe this is updated. Thanks for your feedback!

Thoughts?

The `Mozilla-JSS` JCA-compatible Provider exposes most of the functionality
of JSS to external packages. This interface is the recommend interface most
developers should build against. However, once the dependencies are satisfied
and JSS's native component are available to the JVM, we still have to load
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are->is

There are two routes to do this:

1. Via the `CryptoManager` interface, _and_
2. Via `java.security`, directly loading the `JSSProvider`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSSProvider -> JSS Provider.

Signed-off-by: Alexander Scheel <ascheel@redhat.com>
Also add clearer InvalidLengthException descriptions.

Signed-off-by: Alexander Scheel <ascheel@redhat.com>
@cipherboy
Copy link
Member Author

This can always be updated in future PRs. Merging!

@cipherboy cipherboy merged commit fe382e5 into dogtagpki:master Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Changes related to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants