/**
 * @author      ETSI / STF481 / Yann Garcia
 * @version     $URL$
 *              $Id$
 */
package org.etsi.certificates.io;

import java.io.ByteArrayOutputStream;

/**
 * 
 * @desc Interface to load certificates/private keys from disk
 *
 */
public interface ICertificatesIO {
    
    /**
     * @desc    Load in memory cache the certificates available in the specified directory
     * @param   rootDirectory Root directory to access to the certificates identified by the certificate ID
     * @param   configId      A configuration identifier
     * @return  true on success, false otherwise
     */
    boolean loadCertificates(final String rootDirectory, final String configId);
    
    /**
     * @desc    Unload from memory cache the certificates
     * @return  true on success, false otherwise
     */
    boolean unloadCertificates();
    
    /**
     * @desc    Read the specified certificate
     * @param   certificateId the certificate identifier
     * @param   certificate   the expected certificate
     * @return  true on success, false otherwise
     */
    boolean readCertificate(final String certificateId, final ByteArrayOutputStream certificate);
    
    /**
     * @desc    Read the private keys for the specified certificate
     * @param   keysId            the keys identifier
     * @param   signingPrivateKey the signing private key
     * @param   encryptPrivateKey the encrypt private key
     * @return  true on success, false otherwise
     */
    boolean readPrivateKeys(final String keysName, final ByteArrayOutputStream signingPrivateKey, final ByteArrayOutputStream encryptPrivateKey);
    
} // End of interface ICertificatesIO
