OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 177 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 177 Rev 180
Line 56... Line 56...
56
     * @param privateKeyPem the private key PEM file
56
     * @param privateKeyPem the private key PEM file
57
     * @param certificatePem the certificate(s) PEM file
57
     * @param certificatePem the certificate(s) PEM file
58
     * @param the password to set to protect the private key
58
     * @param the password to set to protect the private key
59
     */
59
     */
60
    public static KeyStore createKeyStore(File privateKeyPem, File certificatePem, final String password) throws IOException, GeneralSecurityException {
60
    public static KeyStore createKeyStore(File privateKeyPem, File certificatePem, final String password) throws IOException, GeneralSecurityException {
-
 
61
        if (!privateKeyPem.exists()) {
-
 
62
            throw new IllegalArgumentException("private key file missing : " + privateKeyPem.getAbsolutePath());
-
 
63
        }
-
 
64
        if (!certificatePem.exists()) {
-
 
65
            throw new IllegalArgumentException("certificate file missing : " + certificatePem.getAbsolutePath());
-
 
66
        }
61
        final X509Certificate[] cert = createCertificates(certificatePem);
67
        final X509Certificate[] cert = createCertificates(certificatePem);
62
        final KeyStore keystore = KeyStore.getInstance("JKS");
68
        final KeyStore keystore = KeyStore.getInstance("JKS");
63
        keystore.load(null);
69
        keystore.load(null);
64
        // Import private key
70
        // Import private key
65
        final PrivateKey key = createPrivateKey(privateKeyPem);
71
        final PrivateKey key = createPrivateKey(privateKeyPem);