All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.parosproxy.paros.security.SslCertificateService Maven / Gradle / Ivy

Go to download

The Zed Attack Proxy (ZAP) is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing. ZAP provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.

There is a newer version: 2.15.0
Show newest version
/*
 * Zed Attack Proxy (ZAP) and its related class files.
 *
 * ZAP is an HTTP/HTTPS proxy for assessing web application security.
 *
 * Copyright 2011 [email protected]
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.parosproxy.paros.security;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SignatureException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;

/**
 * Create SSL certificates on the fly, signed by Paros Proxy CA.
 *
 * @author MaWoKi
 */
public interface SslCertificateService {

    /** The passphrase which is used for all Paros Proxy SSL crypto stuff */
    char[] PASSPHRASE = "0w45P.Z4p".toCharArray();
    /** The alias name used in key stores. */
    String ZAPROXY_JKS_ALIAS = "owasp_zap_root_ca";

    /**
     * Generate a certificate signed by our CA's intermediate certificate. Thy certificate, private
     * key and public key are returned in one {@link KeyStore} available with alias {@link
     * #ZAPROXY_JKS_ALIAS}.
     *
     * @param hostname
     * @return a {@link KeyStore} which contains root certificate, signed certificate, private key
     *     and public key of signed certificate
     * @throws NoSuchAlgorithmException
     * @throws InvalidKeyException
     * @throws CertificateException
     * @throws NoSuchProviderException
     * @throws SignatureException
     * @throws KeyStoreException
     * @throws IOException
     * @throws UnrecoverableKeyException
     * @throws MissingRootCertificateException when it wasn't initialized.
     */
    KeyStore createCertForHost(String hostname)
            throws NoSuchAlgorithmException, InvalidKeyException, CertificateException,
                    NoSuchProviderException, SignatureException, KeyStoreException, IOException,
                    UnrecoverableKeyException;

    /**
     * Generate a certificate signed by our CA's intermediate certificate. Thy certificate, private
     * key and public key are returned in one {@link KeyStore} available with alias {@link
     * #ZAPROXY_JKS_ALIAS}.
     *
     * @param certData
     * @return a {@link KeyStore} which contains root certificate, signed certificate, private key
     *     and public key of signed certificate
     * @throws NoSuchAlgorithmException
     * @throws InvalidKeyException
     * @throws CertificateException
     * @throws NoSuchProviderException
     * @throws SignatureException
     * @throws KeyStoreException
     * @throws IOException
     * @throws UnrecoverableKeyException
     * @throws MissingRootCertificateException when it wasn't initialized.
     */
    default KeyStore createCertForHost(CertData certData)
            throws NoSuchAlgorithmException, InvalidKeyException, CertificateException,
                    NoSuchProviderException, SignatureException, KeyStoreException, IOException,
                    UnrecoverableKeyException {
        return createCertForHost(certData.getCommonName());
    }

    /**
     * Loads CA's private key, public key and X.509 certificate into this bean.
     *
     * @param keystore
     * @throws KeyStoreException
     * @throws NoSuchAlgorithmException
     * @throws UnrecoverableKeyException
     */
    void initializeRootCA(KeyStore keystore)
            throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy