Skip to content

Commit

Permalink
Use the BouncyCastleProvider class directly
Browse files Browse the repository at this point in the history
This avoids issues where a shaded version of BCProvider is installed in the
system JCE provider list, which can result in problems when we pass an
ECNamedCurveParameterSpec from a different shaded version of BC.

Fixes: aws#68
  • Loading branch information
Bryan Donlan committed Aug 22, 2018
1 parent 2a6e6e4 commit c4b5942
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* NOTE: This is not a stable API and may undergo breaking changes in the future.
*/
public abstract class TrailingSignatureAlgorithm {
private static final BouncyCastleProvider BC_PROVIDER = new BouncyCastleProvider();

private TrailingSignatureAlgorithm() {
/* Do not allow arbitrary subclasses */
}
Expand Down Expand Up @@ -84,7 +86,7 @@ public String serializePublicKey(PublicKey key) {

@Override
public KeyPair generateKey() throws GeneralSecurityException {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("ECDSA", "BC");
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("ECDSA", BC_PROVIDER);
keyGen.initialize(ecSpec, Utils.getSecureRandom());

return keyGen.generateKeyPair();
Expand Down

0 comments on commit c4b5942

Please sign in to comment.