log.finest("About to store newly generated material in key store...");
if (Configuration.DEBUG) log.fine("About to store newly generated material in key store...");
  void start() throws CertificateException, KeyStoreException,      InvalidKeyException, SignatureException, IOException,      NoSuchAlgorithmException  {    log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$    // 1. generate a new key-pair    log.finer("About to generate key-pair..."); //$NON-NLS-1$    keyPairGenerator.initialize(keySize);    KeyPair kp = keyPairGenerator.generateKeyPair();    PublicKey publicKey = kp.getPublic();    PrivateKey privateKey = kp.getPrivate();    // 2. generate a self-signed certificate    log.finer("About to generate a self-signed certificate..."); //$NON-NLS-1$    byte[] derBytes = getSelfSignedCertificate(distinguishedName,                                               publicKey,                                               privateKey);    log.finest(Util.dumpString(derBytes, "derBytes ")); //$NON-NLS-1$    CertificateFactory x509Factory = CertificateFactory.getInstance(Main.X_509);    ByteArrayInputStream bais = new ByteArrayInputStream(derBytes);    Certificate certificate = x509Factory.generateCertificate(bais);    log.finest("certificate = " + certificate); //$NON-NLS-1$    // 3. store it, w/ its private key, associating them to alias    Certificate[] chain = new Certificate[] { certificate };    log.finest("About to store newly generated material in key store..."); //$NON-NLS-1$    store.setKeyEntry(alias, privateKey, keyPasswordChars, chain);    // 4. persist the key store    saveKeyStore();    log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$  }