Support use of non-system providers

Issue #159 new
Pawel Veselov created an issue

Currently, code like in KeyPairUtil forces use of system providers. A custom provider name can be passed in, but it must be registered with JCA. In some cases, such registration is not desired (i.e. when one module does not want to expose a provider onto the rest of the code running in the same class loader/JVM).

If an instance of an actual Provider could be passed to, say, KeyPairUtil, and KeyPairUtil used that to get (in this example, KeyPairGenerator), then the provider won’t have to be registered.

Comments (3)

  1. Brian Campbell repo owner

    Would you accept a merge request that resolves this?

    That’s a strong maybe from me. But I’d like to probe with a few questions to better understand.

    Are your needs only for using an actual instance of a Provider for key pair generation? Or do you need the same for other operations (like how provider name can be specified for various things with https://static.javadoc.io/org.bitbucket.b_c/jose4j/0.7.0/org/jose4j/jca/ProviderContext.html)?

    The former is easier. But also KeyPairUtil doesn’t do that much and it would be pretty easy to write you own key generation utility type code that can take a Provider instance.

    The latter is a bit more involved. But would seem to be the consistent and “right” way to do something like this.

  2. Log in to comment