Search in sources :

Example 6 with CertificatesManager

use of com.bluenimble.platform.crypto.generator.CertificatesManager in project serverless by bluenimble.

the class ExportPKCS10CSRCertificate method main.

public static void main(String[] args) throws CertificateExportException, StoreLoaderException, IOException, CertificateException {
    String storeFileName = "files/test.p12";
    String certFileName = "files/test.csr";
    Map<String, Object> EMPTY_MAP = new HashMap<String, Object>();
    // Create generator instance
    CertificatesManager manager = new DefaultCertificatesManager();
    // Export Certification Request
    OutputStream os = new FileOutputStream(certFileName);
    manager.export(manager.load(new FileInputStream(storeFileName), EMPTY_MAP), EMPTY_MAP, CertificatesManager.ExportFormat.PKCS10_CSR, os);
    os.close();
}
Also used : HashMap(java.util.HashMap) DefaultCertificatesManager(com.bluenimble.platform.crypto.generator.impl.DefaultCertificatesManager) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) CertificatesManager(com.bluenimble.platform.crypto.generator.CertificatesManager) DefaultCertificatesManager(com.bluenimble.platform.crypto.generator.impl.DefaultCertificatesManager) FileInputStream(java.io.FileInputStream)

Aggregations

CertificatesManager (com.bluenimble.platform.crypto.generator.CertificatesManager)6 DefaultCertificatesManager (com.bluenimble.platform.crypto.generator.impl.DefaultCertificatesManager)6 FileInputStream (java.io.FileInputStream)6 FileOutputStream (java.io.FileOutputStream)5 OutputStream (java.io.OutputStream)5 HashMap (java.util.HashMap)5 SecureDocument (com.bluenimble.platform.crypto.SecureDocument)1 CertificateAcceptor (com.bluenimble.platform.crypto.signer.CertificateAcceptor)1 Signer (com.bluenimble.platform.crypto.signer.Signer)1 SignerException (com.bluenimble.platform.crypto.signer.SignerException)1 DefaultSigner (com.bluenimble.platform.crypto.signer.impl.DefaultSigner)1 StringSecureDocument (com.bluenimble.platform.crypto.signer.impl.StringSecureDocument)1 KeyStore (java.security.KeyStore)1 PrivateKey (java.security.PrivateKey)1 X509Certificate (java.security.cert.X509Certificate)1