add explicit provider setup for bouncy castle (#1500)

When upgrading JGit, the automatic provider declaration was removed. This led to a runtime error where the provider for gpg signatures could not be found. This PR reintegrates the provider setup for the Bouncy Castle GPG Provider.
This commit is contained in:
Konstantin Schaper
2021-01-21 14:34:13 +01:00
committed by GitHub
parent 4b6c4d4eb7
commit ed6d9a0df0
3 changed files with 19 additions and 0 deletions

View File

@@ -41,9 +41,16 @@ import javax.validation.constraints.NotNull;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.Security;
class DefaultPrivateKey implements PrivateKey {
static {
if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
Security.addProvider(new BouncyCastleProvider());
}
}
static DefaultPrivateKey parseRaw(String rawPrivateKey) {
return new DefaultPrivateKey(KeysExtractor.extractPrivateKey(rawPrivateKey));
}