Package java.security

Examples of java.security.KeyStore.store()


      FileOutputStream fos = new FileOutputStream(file);
      try {
          KeyStore store = KeyStore.getInstance("JCEKS"); //$NON-NLS-1$
          store.load(null,null);
        store.setKeyEntry(DEFAULT_ALIAS, key, DEFAULT_STORE_PASSWORD.toCharArray(),null);
        store.store(fos, DEFAULT_STORE_PASSWORD.toCharArray());
      } catch (GeneralSecurityException e) {
        throw new CryptoException(e);
      } finally {
        fos.close();
     
View Full Code Here


        FileOutputStream  out = null;
       
        try{
          out = new FileOutputStream(name);
     
          keystore.store(out, SESecurityManager.SSL_PASSWORD.toCharArray());
     
        }finally{
         
          if ( out != null ){
           
View Full Code Here

      FileOutputStream  out = null;
     
      try{
        out = new FileOutputStream(keystore_name);
     
        key_store.store(out, SESecurityManager.SSL_PASSWORD.toCharArray());
       
      }catch( Throwable e ){
       
        Debug.printStackTrace( e );
       
View Full Code Here

        FileOutputStream  out = null;
       
        try{
          out = new FileOutputStream(truststore_name);
     
          keystore.store(out, SESecurityManager.SSL_PASSWORD.toCharArray());
     
        }finally{
         
          if ( out != null ){
           
View Full Code Here

                    synchronized (kStore)
                    {
                        kStore.setCertificateEntry(
                            String.valueOf(System.currentTimeMillis()), cert);

                        kStore.store(new FileOutputStream(getKeyStoreLocation()),
                            defaultPassword);
                    }
                }
                catch (Exception e)
                {
View Full Code Here

                    // trusting one single certificate
                    for (X509Certificate c : chain)
                        kStore.setCertificateEntry(
                            String.valueOf(System.currentTimeMillis()), c);

                    kStore.store(
                        new FileOutputStream(getKeyStoreLocation()),
                        defaultPassword);
                }
            } catch (Throwable e)
            {
View Full Code Here

            PrivateKey keypair = ((ShowKeyStoreForm) form).getSelectedKeyStore().getPrivateKey(sel,
                            password);
          KeyStore userStore = KeyStore.getInstance("PKCS12", "BC");
          userStore.load(null, null);
          userStore.setKeyEntry(sel, keypair, ((ShowKeyStoreForm) form).getPassword().toCharArray(), ((ShowKeyStoreForm) form).getSelectedKeyStore().getCertificateChain(sel));
          userStore.store(out, ((ShowKeyStoreForm) form).getPassword().toCharArray());
          out.close();
        }
        l.addDownload(new CSRDownload(clientCertFile, clientCertFile.getName(), "application/octet-stream", mapping.findForward("success"),
                        "exportPrivateKey.message", "keystore", sel));
        return mapping.findForward("success");
View Full Code Here

                   
                    // creating an empty java keystore
                    final KeyStore ks = KeyStore.getInstance("JKS");
                    ks.load(null,keyStorePwd.toCharArray());
                    final FileOutputStream ksOut = new FileOutputStream(keyStoreFileName);
                    ks.store(ksOut, keyStorePwd.toCharArray());
                    ksOut.close();
                   
                    // storing path to keystore into config file
                    this.switchboard.setConfig("keyStore", keyStoreFileName);
                }
View Full Code Here

        }       
       
        // storing jdk into file
        System.err.print("Storing java keystore");
        final FileOutputStream jksFileOut = new FileOutputStream(jksName);
        jks.store(jksFileOut,(jksPassword!=null)?jksPassword.toCharArray():null);
        jksFileOut.close();
        System.err.print("Import finished.");
    }
   
    /**
 
View Full Code Here

        }
        try {
            KeyStore keystore = KeyStore.getInstance(keystoreType);
            keystore.load(null, password);
            OutputStream out = new BufferedOutputStream(new FileOutputStream(test));
            keystore.store(out, password);
            out.flush();
            out.close();
            return getKeystore(name, keystoreType);
        } catch (KeyStoreException e) {
            throw new KeystoreException("Unable to create keystore", e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.