Package java.security

Examples of java.security.KeyStore.store()


        CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
        Certificate cert = factory.generateCertificate( in );
        KeyStore ks = KeyStore.getInstance( KeyStore.getDefaultType() );
        ks.load( null, null );
        ks.setCertificateEntry( "apacheds", cert );
        ks.store( new FileOutputStream( ksFile ), "changeit".toCharArray() );
    }
}
View Full Code Here


            stream=new FileOutputStream(keyStoreName);
            SecretKey key=initSymKey();
            KeyStore store=KeyStore.getInstance("JCEKS");
            store.load(null, null);
            store.setKeyEntry(alias, key, storePass.toCharArray(), null);
            store.store(stream, storePass.toCharArray());

        }
        catch(Exception e) {
            e.printStackTrace();
        }
View Full Code Here

    store.setKeyEntry(CipherCodecFactory.Property.KEY_ALIAS.defaultValue, this.key, KEY_PASSWORD.toCharArray(), null);
   
    FileOutputStream out = new FileOutputStream(file);
    try
    {
      store.store(out, STORE_PASSWORD.toCharArray());
    }
    finally
    {
      Resources.close(out);
    }
View Full Code Here

     stream= new FileOutputStream(keyStoreName);
     SecretKey key = initSymKey();
     KeyStore store = KeyStore.getInstance("JCEKS");
     store.load(null,null);
     store.setKeyEntry(alias,key,storePass.toCharArray(),null);
     store.store(stream,storePass.toCharArray());
    
     } catch (Exception e){
       e.printStackTrace();
     }
     finally{
View Full Code Here

   public static void createKeyStore(String path, char[] storePass) throws Exception
   {
      KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
      ks.load(null, storePass); //creates an empty keystore
     
      ks.store(new FileOutputStream(new File(path)), storePass);
      System.out.println("Keystore created");
   }
  
   /**
    * Get the Keystore given the url to the keystore file as a string
View Full Code Here

        CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
        Certificate cert = factory.generateCertificate( in );
        KeyStore ks = KeyStore.getInstance( KeyStore.getDefaultType() );
        ks.load( null, null );
        ks.setCertificateEntry( "apacheds", cert );
        ks.store( new FileOutputStream( ksFile ), "changeit".toCharArray() );
        LOG.debug( "Keystore file installed: {}", ksFile.getAbsolutePath() );

        oldConfidentialityRequiredValue = getLdapServer().isConfidentialityRequired();
    }
View Full Code Here

        CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
        Certificate cert = factory.generateCertificate( in );
        KeyStore ks = KeyStore.getInstance( KeyStore.getDefaultType() );
        ks.load( null, null );
        ks.setCertificateEntry( "apacheds", cert );
        ks.store( new FileOutputStream( ksFile ), "changeit".toCharArray() );
        LOG.debug( "Keystore file installed: {}", ksFile.getAbsolutePath() );

        oldConfidentialityRequiredValue = getLdapServer().isConfidentialityRequired();
    }
View Full Code Here

        CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
        Certificate cert = factory.generateCertificate( in );
        KeyStore ks = KeyStore.getInstance( KeyStore.getDefaultType() );
        ks.load( null, null );
        ks.setCertificateEntry( "apacheds", cert );
        ks.store( new FileOutputStream( ksFile ), "changeit".toCharArray() );
        LOG.debug( "Keystore file installed: {}", ksFile.getAbsolutePath() );

        oldConfidentialityRequiredValue = getLdapServer().isConfidentialityRequired();
    }
View Full Code Here

    ks.setCertificateEntry(alias, cert);

    System.out.println("Adding JSSE certificates under 'java.home': " + dir.getAbsolutePath() + "\\jssecacerts");
    OutputStream out = new FileOutputStream(System.getProperty("java.home") + SEP
      + "lib" + SEP + "security" + SEP + "jssecacerts");
    ks.store(out, passphrase);
    out.close();

    System.out.println();
    System.out.println(cert);
    System.out.println();
View Full Code Here

        // persist the key-store
        File ksFile = File.createTempFile("gkr-", ".gks");
        ksFile.deleteOnExit();
        FileOutputStream fos = new FileOutputStream(ksFile);
        ks1.store(fos, STORE_PASSWORD);
        fos.flush();
        fos.close();
        // re-load it from the persisted file
        KeyStore ks2 = KeyStore.getInstance("gkr");
        FileInputStream fis = new FileInputStream(ksFile);
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.