Package org.ejbca.ui.cli

Examples of org.ejbca.ui.cli.ErrorAdminCommandException


    }
    private PrivateKey getPrivateKey(String alias) throws Exception {
        final PrivateKey key = (PrivateKey)getKey(alias);
        if ( key==null ) {
            String msg = intres.getLocalizedMessage("catoken.errornokeyalias", alias);
            throw new ErrorAdminCommandException(msg);
        }
        return key;
    }
View Full Code Here


    }
    private X509Certificate getCertificate( String alias ) throws KeyStoreException, ErrorAdminCommandException {
        final X509Certificate cert = (X509Certificate)this.keyStore.getCertificate(alias);
        if ( cert==null ) {
            String msg = intres.getLocalizedMessage("catoken.errornocertalias", alias);
            throw new ErrorAdminCommandException(msg);
        }
        return cert;
    }
View Full Code Here

                        }
                    }
                }
            }         
        } catch (Exception e) {
            throw new ErrorAdminCommandException(e);
        }
    }
View Full Code Here

            }else{
              getPrintStream().println("\n  The query didn't match any certificates");
            }
       
        } catch (Exception e) {
            throw new ErrorAdminCommandException(e);
        }
    }
View Full Code Here

    try {
      CryptoProviderTools.installBCProvider();
      Collection<Certificate> certs = CertTools.getCertsFromPEM(pemFile);
      if (certs.size() != 1) {
        throw new ErrorAdminCommandException("PEM file must only contain one CA certificate, this PEM file contains "+certs.size()+".");
      }
      if (initAuth) {
        String subjectdn = CertTools.getSubjectDN(certs.iterator().next());
        Integer caid = Integer.valueOf(subjectdn.hashCode());
        getLogger().info("Initializing authorization module for caid: "+caid+", superadmincn='"+superAdminCN+"'");
View Full Code Here

            }else{
              displayRequestErrors(reissueResultType);
            }
   
        } catch (Exception e) {
            throw new ErrorAdminCommandException(e);
        }
    }
View Full Code Here

                        alias = (String)aliases.nextElement();
                        getLogger().info("Keystore contains alias: "+alias);
                        length++;
                    }
                    if (length > 1) {
                      throw new ErrorAdminCommandException("Keystore contains more than one alias, alias must be provided as argument.");
                    } else if (length < 1) {
                      throw new ErrorAdminCommandException("Keystore does not contains any aliases. It can not be used for a CA.");
                    }
                    // else alias already contains the only alias, so we can use that
                }
                ejb.getCAAdminSession().importCAFromKeyStore(getAdmin(), caName, keystorebytes, kspwd, kspwd, alias, encryptionAlias);           
          } else {
            // Import HSM keystore
                // "Usage2: CA importca <CA name> <catokenclasspath> <catokenpassword> <catokenproperties> <ca-certificate-file>\n" +
            String tokenclasspath = args[2];
            String tokenpwd = args[3];
            String catokenproperties = new String(FileTools.readFiletoBuffer(args[4]));
            Collection<Certificate> cacerts = CertTools.getCertsFromPEM(args[5]);
            Certificate[] cacertarray = cacerts.toArray(new Certificate[0]);
            ejb.getCAAdminSession().importCAFromHSM(getAdmin(), caName, cacertarray, tokenpwd, tokenclasspath, catokenproperties);
          }
        } catch (ErrorAdminCommandException e) {
          throw e;
        } catch (Exception e) {
            throw new ErrorAdminCommandException(e);
        }
    }
View Full Code Here

            }else{
              displayRequestErrors(recoverResultType);
            }
   
        } catch (Exception e) {
            throw new ErrorAdminCommandException(e);
        }
    }
View Full Code Here

                      }
                    }
                }
            }
        } catch (Exception e) {
            throw new ErrorAdminCommandException(e);
        }
    }
View Full Code Here

    }
    try {
      String caName = args[1];
      ejb.getCAAdminSession().removeCAKeyStore(getAdmin(), caName);
    } catch (Exception e) {
      throw new ErrorAdminCommandException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.ejbca.ui.cli.ErrorAdminCommandException

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.