public void verify(char[] password) {
      if (!isMasked() || payload == null) {
         return;
      }
      IMac m = null;
      try {
         m = getMac(password);
      } catch (Exception x) {
         throw new IllegalArgumentException(x.toString());
      }

      m.update(payload, 0, payload.length - m.macSize());
      byte[] macValue = new byte[m.macSize()];
      System.arraycopy(payload, payload.length - macValue.length, macValue, 0, macValue.length);
      if (!Arrays.equals(macValue, m.digest())) {
         throw new IllegalArgumentException("MAC verification failed");
      }
      try {
         DataInputStream in =
               new DataInputStream(new ByteArrayInputStream(payload, 0, payload.length - m.macSize()));
         decodeEnvelope(in);
      } catch (IOException ioe) {
         throw new IllegalArgumentException("malformed keyring fragment");
      }
      setMasked(false);
      payload = null;
   }