Package java.security

Examples of java.security.KeyStore$ProtectionParameter


     
      return( false );
    }
   
    try{
      KeyStore key_store = loadKeyStore();
     
      Enumeration enumx = key_store.aliases();
     
      if ( !enumx.hasMoreElements()){
        Logger.logTextResource(new LogAlert(LogAlert.UNREPEATABLE,
            LogAlert.AT_ERROR, "Security.keystore.empty"),
            new String[] { keystore_name });
View Full Code Here


    String  name )
  {
    try{
      this_mon.enter();
   
      KeyStore keystore = KeyStore.getInstance( KEYSTORE_TYPE );
     
      if ( !new File(name).exists()){
   
        keystore.load(null,null);
     
        FileOutputStream  out = null;
       
        try{
          out = new FileOutputStream(name);
     
          keystore.store(out, SESecurityManager.SSL_PASSWORD.toCharArray());
     
        }finally{
         
          if ( out != null ){
           
View Full Code Here

  public KeyStore
  getTrustStore()
 
    throws Exception
  {
    KeyStore keystore = KeyStore.getInstance( KEYSTORE_TYPE );
   
    if ( !new File(truststore_name).exists()){
 
      keystore.load(null,null);
     
    }else{
   
      FileInputStream    in   = null;

      try{
        in = new FileInputStream(truststore_name);
   
        keystore.load(in, SESecurityManager.SSL_PASSWORD.toCharArray());
       
      }finally{
       
        if ( in != null ){
         
View Full Code Here

  loadKeyStore(
    KeyManagerFactory  keyManagerFactory )
   
    throws Exception
  {
    KeyStore key_store = KeyStore.getInstance( KEYSTORE_TYPE );
   
    if ( !new File(keystore_name).exists()){
     
      key_store.load(null,null);
     
    }else{
     
      InputStream kis = null;
     
      try{
        kis = new FileInputStream(keystore_name);
     
        key_store.load(kis, SESecurityManager.SSL_PASSWORD.toCharArray());
       
      }finally{
       
        if ( kis != null ){
         
View Full Code Here

 
    throws Exception
  {
    // Create the key manager factory used to extract the server key
       
    KeyStore key_store = loadKeyStore();
   
    final Key key = key_store.getKey( alias, SESecurityManager.SSL_PASSWORD.toCharArray());
   
    if ( key == null ){
     
      return( null );
    }
   
    java.security.cert.Certificate[]  chain = key_store.getCertificateChain( alias );

    final X509Certificate[]  res = new X509Certificate[chain.length];
   
    for (int i=0;i<chain.length;i++){
     
View Full Code Here

  getSSLSocketFactory()
  {
    try{
      this_mon.enter();
   
      KeyStore keystore = getTrustStore();
           
      TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
     
      tmf.init(keystore);
     
View Full Code Here

       
        Object[]  handler = (Object[])certificate_handlers.get( url_s );
       
        String  alias = host.concat(":").concat(String.valueOf(port));
       
        KeyStore keystore = getTrustStore();

        byte[]  new_encoded = x509_cert.getEncoded();
       
        int  count = 0;
       
        while( count < 256 ){
         
          String  test_alias = count==0?alias:(alias + "." + count );
         
          Certificate existing = keystore.getCertificate( test_alias );
       
          if ( existing != null ){
         
            if ( Arrays.equals( new_encoded, existing.getEncoded())){
           
View Full Code Here

    throws Exception
  {
    try{
      this_mon.enter();
   
      KeyStore keystore = getTrustStore();
     
      if ( cert != null ){
       
        if ( keystore.containsAlias( alias )){
       
          keystore.deleteEntry( alias );
        }
             
        keystore.setCertificateEntry(alias, cert);
 
        FileOutputStream  out = null;
       
        try{
          out = new FileOutputStream(truststore_name);
     
          keystore.store(out, SESecurityManager.SSL_PASSWORD.toCharArray());
     
        }finally{
         
          if ( out != null ){
           
View Full Code Here

     *
     * @param args the command line parameters
     */
    public static void main(String... args) throws Exception {
        String password = CipherFactory.KEYSTORE_PASSWORD;
        KeyStore store = CipherFactory.getKeyStore(password);
        printKeystore(store, password);
    }
View Full Code Here

        file = new File(file, "security");
        file = new File(file, "cacerts");
        FileInputStream fin = null;
        try {
            fin = new FileInputStream(file);
            KeyStore k;
            if (provider == null)
                k = KeyStore.getInstance("JKS");
            else
                k = KeyStore.getInstance("JKS", provider);
            k.load(fin, null);
            return k;
        }
        catch (Exception e) {
            throw new ExceptionConverter(e);
        }
View Full Code Here

TOP

Related Classes of java.security.KeyStore$ProtectionParameter

Copyright © 2018 www.massapicom. 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.