public void engineLoad(InputStream in, char[] password)
      throws IOException
   {
      if (in != null) {
         if (!in.markSupported()) {
            in = new BufferedInputStream(in);
         }
         in.mark(5);
         for (int i = 0; i < 4; i++)
            if (in.read() != Registry.GKR_MAGIC[i])
               throw new MalformedKeyringException("incorrect magic");
         int usage = in.read();
         in.reset();
         HashMap attr = new HashMap();
         attr.put(IKeyring.KEYRING_DATA_IN, in);
         attr.put(IKeyring.KEYRING_PASSWORD, password);
         switch (usage) {
            case GnuPublicKeyring.USAGE:
               keyring = new GnuPublicKeyring();
               break;
            case GnuPrivateKeyring.USAGE:
               keyring = new GnuPrivateKeyring();
               break;
            default:
               throw new MalformedKeyringException("unsupported ring usage");
         }
         keyring.load(attr);
      }
      loaded = true;
   }