log.finest("certificate = " + certificate);
if (Configuration.DEBUG) log.fine("certificate = " + certificate);
  private void ensureReplyIsOurs(Collection certificates) throws IOException,      UnsupportedCallbackException, KeyStoreException  {    log.entering(this.getClass().getName(), "ensureReplyIsOurs"); //$NON-NLS-1$    Certificate certificate = (Certificate) certificates.iterator().next();    log.finest("certificate = " + certificate); //$NON-NLS-1$    Certificate[] chain = store.getCertificateChain(alias);    if (chain == null)      throw new IllegalArgumentException(Messages.getFormattedString("ImportCmd.37", //$NON-NLS-1$                                                                     alias));    selfSignedCertificate = (X509Certificate) chain[0];    PublicKey anchorPublicKey = selfSignedCertificate.getPublicKey();    PublicKey certPublicKey = certificate.getPublicKey();    boolean sameKey;    if (anchorPublicKey instanceof DSAPublicKey)      {        DSAPublicKey pk1 = (DSAPublicKey) anchorPublicKey;        if (!(certPublicKey instanceof DSAPublicKey))          throw new IllegalArgumentException(Messages.getString("ImportCmd.38")); //$NON-NLS-1$        sameKey = areEqual(pk1, (DSAPublicKey) certPublicKey);      }    else if (anchorPublicKey instanceof RSAPublicKey)      {        RSAPublicKey pk1 = (RSAPublicKey) anchorPublicKey;        if (!(certPublicKey instanceof RSAPublicKey))          throw new IllegalArgumentException(Messages.getString("ImportCmd.38")); //$NON-NLS-1$        sameKey = areEqual(pk1, (RSAPublicKey) certPublicKey);      }    else      throw new IllegalArgumentException(          Messages.getFormattedString("ImportCmd.40", //$NON-NLS-1$                                      new String[] { alias,                                                     anchorPublicKey.getClass().getName() }));    if (! sameKey)      throw new IllegalArgumentException(Messages.getString("ImportCmd.41")); //$NON-NLS-1$    log.exiting(this.getClass().getName(), "ensureReplyIsOurs"); //$NON-NLS-1$  }