public String engineGetCertificateAlias(Certificate cert) {
      if (!loaded) {
         throw NOT_LOADED;
      }
      if (keyring == null) {
         return null;
      }
      if (!(keyring instanceof IPublicKeyring)) {
         throw new IllegalStateException("not a public keyring");
      }
      Enumeration aliases = keyring.aliases();
      while (aliases.hasMoreElements()) {
         String alias = (String) aliases.nextElement();
         Certificate cert2 = ((IPublicKeyring) keyring).getCertificate(alias);
         if (cert.equals(cert2)) {
            return alias;
         }
      }
      return null;
   }