Package java.security

Examples of java.security.KeyStore.store()


    new File(dataDir).mkdirs();
    // Write the keystore file
    storeFile = new File(dataDir, "keystore.jks");
    FileOutputStream os = new FileOutputStream(storeFile);
    try {
      store.store(os, PASSWORD.toCharArray());
    } finally {
      os.close();
    }
    // Write the password file
    Properties p = new Properties();
View Full Code Here


        Certificate cert = it.next();
        ks.setCertificateEntry(cert.getPublicKey().toString(), cert);
      }
      FileOutputStream tmpFOS = new FileOutputStream(TMP_KEYSTORE);
      try {
        ks.store(tmpFOS, new char[0]);
      } finally {
        Closer.close(tmpFOS);
      }
      System.out.println("The CA has been imported into the trustStore");
    } catch(Exception e) {
View Full Code Here

                    break;
                default:
                    throw new IllegalStateException("unknown type " + type);
                   
            }
            ks.store(new FileOutputStream(keyStoreFile), pw);
        } catch (Exception ex) {
            System.err.println(ex.getMessage());
            System.exit(1);
        }
    }
View Full Code Here

        ks.setKeyEntry("gost",sKey, "gost".toCharArray(), new Certificate[] { cert });

        ByteArrayOutputStream bOut = new ByteArrayOutputStream();

        ks.store(bOut, "gost".toCharArray());

        ks = KeyStore.getInstance("JKS");

        ks.load(new ByteArrayInputStream(bOut.toByteArray()), "gost".toCharArray());
View Full Code Here

        //
        // write out and read back store
        //
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();

        store.store(bOut, passwd);

        ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());

        //
        // start with a new key store
View Full Code Here

        //
        // write out and read back store
        //
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();

        store.store(bOut, passwd);

        ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());

        //
        // start with a new key store
View Full Code Here

        //
        store.setKeyEntry("Eric's Key", privKey, null, chain);

        FileOutputStream fOut = new FileOutputStream("id.p12");

        store.store(fOut, passwd);
       
        fOut.close();
    }
}
View Full Code Here

        store.setKeyEntry("key", privKey, null, chain);

        ByteArrayOutputStream bOut = new ByteArrayOutputStream();

        store.store(bOut, passwd);

        store.load(new ByteArrayInputStream(bOut.toByteArray()), passwd);

        Key k = store.getKey("key", null);
View Full Code Here

       
        store2.setKeyEntry("new", newPair.getPrivate(), null, chain2);

        ByteArrayOutputStream bOut = new ByteArrayOutputStream();

        store2.store(bOut, passwd);

        store2.load(new ByteArrayInputStream(bOut.toByteArray()), passwd);

        chain2 = store2.getCertificateChain("new");
View Full Code Here

        //
        // save test
        //
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();

        store.store(bOut, passwd);

        stream = new ByteArrayInputStream(bOut.toByteArray());

        store.load(stream, passwd);
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.