private void loadVCardFile(File vcardFile) {
    if (!vcardFile.exists() || !vcardFile.canRead()) {
      JOptionPane.showMessageDialog(
          this,
          bundle.getString("cannot.read.vcard.file"),
          bundle.getString("error"),
          JOptionPane.ERROR_MESSAGE);
    } else {
      File tmpFile;
      try {
        tmpFile =
            File.createTempFile("panbox-tmp-" + String.valueOf(System.currentTimeMillis()), ".vcf");
        byte[] hmac = VCardProtector.unwrapVCF(vcardFile, tmpFile);

        // load table values
        VCard[] vclist = null;
        // only continue if there are any VCards ..
        if (((vclist = AbstractAddressbookManager.readVCardFile(tmpFile)) != null)
            && (vclist.length > 0)) {
          // remove all existing entries before loading any
          // new ones
          DefaultTableModel tableModel = (DefaultTableModel) importContactsTable.getModel();

          tableModel.setRowCount(0);

          for (VCard vc : vclist) {
            tableModel.addRow(new Object[] {vc});
          }
          byte[] vcfbytes = VCardProtector.loadVCFBytes(tmpFile);
          this.VCFContents = new VCFArchive(hmac, vcfbytes);

        } else {
          JOptionPane.showMessageDialog(
              this,
              bundle.getString("error.reading.contacts.file"),
              bundle.getString("error"),
              JOptionPane.ERROR_MESSAGE);
        }

        this.fileLocTextField.setText(vcardFile.getAbsolutePath());
      } catch (IOException e) {
        logger.error("Could not read VCF archive!", e);
        JOptionPane.showMessageDialog(
            this,
            bundle.getString("cannot.read.vcard.file"),
            bundle.getString("error"),
            JOptionPane.ERROR_MESSAGE);
        this.fileLocTextField.setText("");
        this.VCFContents = null;
      }
    }
  }
 private void checkCurrentPIN() {
   if (this.VCFContents != null) {
     if (ignorePINCheckbox.isSelected()) {
       pinCheckStateLabel.setText(VERIFICATION_FAILED_LABEL);
       pinCheckStateLabel.setForeground(PanboxDesktopGUIConstants.notVerifiedColor);
       // pinCheckStateLabel.setFont(getFont().deriveFont(Font.BOLD));
       isVCFVerified = false;
       checkImportability();
       return;
     } else {
       // check current pin value
       if ((importPINTextField.getText() != null)
           && (importPINTextField.getText().length() >= 4)) {
         boolean ispinvalid =
             VCardProtector.verifyVCFIntegrity(
                 VCFContents.extracedVCF,
                 VCFContents.storedHMac,
                 importPINTextField.getText().toCharArray());
         if (ispinvalid) {
           pinCheckStateLabel.setText(VERIFICATION_OK_LABEL);
           pinCheckStateLabel.setForeground(PanboxDesktopGUIConstants.verifiedColor);
           // pinCheckStateLabel.setFont(getFont().deriveFont(
           // Font.BOLD));
           isVCFVerified = true;
           checkImportability();
           return;
         }
       }
     }
   }
   // default
   pinCheckStateLabel.setText(VERIFICATION_FAILED_LABEL);
   pinCheckStateLabel.setForeground(PanboxDesktopGUIConstants.notVerifiedColor);
   // pinCheckStateLabel.setFont(getFont().deriveFont(Font.BOLD));
   isVCFVerified = false;
   importButton.setEnabled(false);
 }