Demos and Usage of java.security.KeyStore.getInstance(String type,Provider provider)


   1: import java.io.FileOutputStream;
   2: import java.security.KeyStore;
   3: import java.security.cert.Certificate;
   4:         ...
   5:         
   6:         KeyStore keyStore = KeyStore.getInstance("PKCS12", "BC");
   7:         
   8:         ...
   9:         keyStore.load(null, null);
  10:         

View Full Code Here
   1: import java.io.ByteArrayOutputStream;
   2: import java.security.KeyStore;
   3: import java.security.cert.Certificate;
   4:         ...
   5: {
   6:     public static KeyStore createKeyStore()
   7:         throws Exception
   8:         ...
   9:     {
  10:         KeyStore store = KeyStore.getInstance("PKCS12", "BC");
  11: 
  12:         ...
  13: 
  14:         store = KeyStore.getInstance("PKCS12", "BC");

View Full Code Here
   1: import java.security.GeneralSecurityException;
   2: import java.security.KeyStore;
   3: 
   4:         ...
   5: 
   6:     private KeyStore keyStore;
   7: 
   8:         ...
   9:         if (StringUtils.hasLength(provider) && StringUtils.hasLength(type)) {
  10:             keyStore = KeyStore.getInstance(type, provider);
  11:         }

View Full Code Here
   1:       {  
   2:          if (args[i].equals("-keystore"))
   3:             ksname = args[i + 1];
   4:         ...
   5: 
   6:          KeyStore store = KeyStore.getInstance("JKS", "SUN");
   7:          InputStream in = new FileInputStream(ksname);
   8:         ...
   9:          System.out.print("Keystore password: ");
  10:          System.out.flush();

View Full Code Here
   1: import java.security.*;
   2: import java.security.KeyStore;
   3: import java.security.cert.Certificate;
   4:         ...
   5:         Security.addProvider(new BouncyCastleProvider());
   6:     KeyStore    ks = KeyStore.getInstance("PKCS12","BC");
   7: 
   8:         ks.load(new FileInputStream(pkcs12), pwd.toCharArray());

View Full Code Here
   1: import java.io.FileInputStream;
   2: import java.security.KeyStore;
   3: import java.security.cert.CertificateFactory;
   4:         ...
   5: 
   6:     KeyStore ks = KeyStore.getInstance("JKS", "SUN");
   7:     ks.load(
   8:         ...
   9:       new FileInputStream(TESTDATA_ROOT + "security/server.keystore"),
  10:       "changeit".toCharArray());

View Full Code Here
   1:         defaults.put("file", "my.secretkey");
   2:         defaults.put("keystore", "my.keystore");
   3:         defaults.put("storepass", "changeit");
   4:         ...
   5:             "[-algorithm <alg> -keysize <keysize>] [-action store\n" +
   6:             "\t[-keystore <keystore>] [-kstype (JCEKS|JKS)] [-storepass <storepass>]\n" +
   7:             "\t[-alias <alias>] [-keypass <keypass>]] [-provider <provider>]"
   8:         ...
   9:             defaults.get("filename") + "]\n" +
  10:             "  -keystore <keystore>: where to store the key?[" +
  11:             defaults.get("keystore") + "]\n" +
  12:         ...
  13:             if (providerName != null)
  14:                 kg = KeyGenerator.getInstance(algorithm, providerName);

View Full Code Here
   1: import java.security.Security;
   2: import java.security.KeyStore;
   3: import java.security.Key;
   4:         ...
   5:       String storePass = "passphrase";
   6:       String storeFilename = "keystore.xml";
   7: 
   8:         ...
   9: 
  10:       KeyStore keyStore = KeyStore.getInstance("ApacheXML", "ApacheXML");
  11:       boolean createKeyStore = true;

View Full Code Here
   1: 
   2: import java.security.KeyStore;
   3: import java.security.SecureRandom;
   4:         ...
   5: 
   6:   public void setKeystore(String keystore)
   7:   {
   8:         ...
   9:     _keystore = keystore;
  10:   }
  11:         ...
  12:             KEYSTORE_PROVIDER_NAME_PROPERTY + "=" + _keystore_provider_name);
  13:       ks = KeyStore.getInstance(_keystore_type, _keystore_provider_name);

View Full Code Here
   1: import java.io.FileInputStream;
   2: import java.security.KeyStore;
   3: import java.security.SecureRandom;
   4:         ...
   5: 
   6:     public void setKeystore(String keystore)
   7:     {
   8:         ...
   9:         _keystore = keystore;
  10:     }
  11:         ...
  12:             log.info(KEYSTORE_PROVIDER_CLASS_PROPERTY+"="+_keystore_provider_class);
  13:             ks = KeyStore.getInstance(_keystore_type,myprovider.getName());

View Full Code Here
   1: 
   2:     public static KeyStore getKeyStore(String file_name, char[] storepass )
   3:     throws     java.io.IOException, KeyStoreException, NoSuchAlgorithmException,
   4:         ...
   5: 
   6:     KeyStore ks;
   7:     
   8:         ...
   9:     {
  10:         ks = KeyStore.getInstance( "IAIKKeyStore", "IAIK" );
  11:     } 
  12:         ...
  13:         System.err.println ( ex.toString ());
  14:         ks = KeyStore.getInstance("jks");

View Full Code Here
   1: import java.security.cert.*;
   2: import java.security.KeyStore;
   3: import java.security.Key;
   4:         ...
   5:     private String provider = null;
   6:     private KeyStore pkcs12KeyStore = null;
   7:         ...
   8:     private KeyStore jksKeyStore = null;
   9:     
  10:         ...
  11:         }
  12:         pkcs12KeyStore = KeyStore.getInstance("PKCS12", provider);

View Full Code Here
   1: import java.security.*;
   2: import java.security.KeyStore;
   3: import java.security.cert.Certificate;
   4:         ...
   5:         Security.addProvider(new BouncyCastleProvider());
   6:     KeyStore    ks = KeyStore.getInstance("PKCS12","BC");
   7: 
   8:         ...
   9:         Security.addProvider(new BouncyCastleProvider());
  10:     KeyStore    ks = KeyStore.getInstance("PKCS12","BC");

View Full Code Here
   1: {
   2:     private KeyStore ks;
   3: 
   4:         ...
   5:         int option = JOptionPane.showConfirmDialog(null, 
   6:                                "KeyStore modified, save changes?",
   7:                                "Close",
   8:         ...
   9: 
  10:     ksPassword =  UserSponsor.getPasswd("Password for KeyStore " + ksFileName);
  11: 
  12:         ...
  13:         {
  14:             ks = KeyStore.getInstance( "IAIKKeyStore", "IAIK" );

View Full Code Here
   1: 
   2:     KeyStore ks = getKeyStore();
   3:     if (ks == null) {
   4:         ...
   5:     try {
   6:         KeyStore ks = getKeyStore();
   7: 
   8:         ...
   9:     try {
  10:         KeyStore ks = getKeyStore();
  11: 
  12:         ...
  13:     try {
  14:         ks = KeyStore.getInstance("amicerts", "SunAMI");

View Full Code Here