Skip to content
Snippets Groups Projects
Commit 1f8336bb authored by srosse's avatar srosse
Browse files

Merge remote-tracking branch 'origin/OpenOLAT_15.2' into OpenOLAT_15.3

parents c33d419d 25281635
No related branches found
No related tags found
No related merge requests found
......@@ -45,9 +45,9 @@ import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import org.apache.logging.log4j.Logger;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.olat.core.id.OLATResourceable;
import org.apache.logging.log4j.Logger;
import org.olat.core.logging.Tracing;
import org.olat.core.util.StringHelper;
import org.olat.core.util.WebappHelper;
......@@ -159,6 +159,9 @@ public class PersistedProperties implements Initializable, Destroyable{
private String userDataDirectory;
static {
if(Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) != null) {
Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}
Security.insertProviderAt(new BouncyCastleProvider(), 1);
}
......
......@@ -191,7 +191,11 @@ public class QTI21AdminController extends FormBasicController {
logError("", e);
String message = e.getMessage() == null ? "" : e.getMessage();
String [] errorArgs = new String[]{ message };
certificateEl.setErrorKey("error.digital.certificate.cannotread", errorArgs);
if(message != null && message.contains("password")) {
certificateEl.setErrorKey("error.digital.certificate.wrongpassword", errorArgs);
} else {
certificateEl.setErrorKey("error.digital.certificate.cannotread", errorArgs);
}
allOk &= false;
}
......
......@@ -115,6 +115,7 @@ error.choice=Sie m\u00FCssen ein von den folgenden Optionen w\u00E4hlen.
error.digital.certificate.cannotread=Zertifikat konnte nicht gelesen werden.
error.digital.certificate.noPrivateKey=Es wurde kein "Private key" im Zertifikat gefunden. Sie ist erforderlich.
error.digital.certificate.noX509=Es wurde kein X509 Zertifikat gefunden.
error.digital.certificate.wrongpassword=Zertifikat konnte nicht gelesen werden. Wahrscheinlich ist der Passwort inkorrekt.
error.double=F\u00FCr Dezimalzahlen wird das Trennzeichen Punkt und nicht Komma verwendet. Beispiele\: 15.0, 5.5, 10
error.input.choice.max=W\u00E4hlen Sie die {0} zutreffenden Antworten.
error.input.choice.min=W\u00E4hlen Sie mindestens {0} Antwort(en).
......
......@@ -115,6 +115,7 @@ error.choice=You must select one of the following options
error.digital.certificate.cannotread=The certificate could not be read.
error.digital.certificate.noPrivateKey=The "private key" could not be found. It is mandatory.
error.digital.certificate.noX509=The X509 certificate could not be found in the uploaded file.
error.digital.certificate.wrongpassword=The certificate could not be read. Probably is the password wrong.
error.double=For decimal numbers point and not comma is used as separator. Examples\: 15.0, 5.5, 10
error.input.choice.max=You must select at the most {0} choices.
error.input.choice.min=You must select at least {0} choice(s).
......
......@@ -32,5 +32,6 @@ event.title=Titel
select=Ausw\u00E4hlen
series.contributors=Mitwirkende
series.description=Beschreibung
series.identifier=Identifier
series.subjects=Betreff
series.title=Titel
......@@ -32,5 +32,6 @@ event.title=Title
select=Select
series.contributors=Contributors
series.description=Description
series.identifier=Identifier
series.subjects=Subjects
series.title=Title
......@@ -22,9 +22,14 @@ package org.olat.core.util.xml;
import java.io.File;
import java.net.URL;
import java.nio.file.Files;
import java.security.Provider;
import java.security.Security;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.olat.core.configuration.PersistedProperties;
import org.olat.core.util.FileUtils;
import org.olat.core.util.crypto.CryptoUtil;
import org.olat.core.util.crypto.X509CertificatePrivateKeyPair;
......@@ -40,6 +45,22 @@ import org.w3c.dom.NodeList;
*/
public class XMLDigitalSignatureUtilTest {
/**
* BouncyCastle is loaded and controller by PersistedProperties.
*/
@BeforeClass
public static void loadBouncyCastle() {
new PersistedProperties(event -> {
//
});
}
@Test
public void bouncyCastleAtFirstPlace() throws Exception {
Provider[] providers = Security.getProviders();
Assert.assertEquals(BouncyCastleProvider.PROVIDER_NAME, providers[0].getName());
}
/**
* Preliminary test which read the certificate. The method is used in
* every other test of the class.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment