Package net.suberic.pooka

Examples of net.suberic.pooka.MessageCryptoInfo


    MessageInfo info = getMessageInfo();
    if (info != null) {
      try {
        if (info.hasEncryption()) {

          MessageCryptoInfo cInfo = info.getCryptoInfo();

          if (cInfo != null && cInfo.isEncrypted()) {

            java.security.Key key = getDefaultProfile().getEncryptionKey(
                cInfo.getEncryptionType(), forSiganture);

            if (key != null) {
              try {
                cInfo.decryptMessage(key, true);
              } catch (Exception e) {
                // ignore here.
              }
            }

            if (key == null) {
              try {
                key = selectPrivateKey(
                    Pooka.getProperty("Pooka.crypto.privateKey.forDecrypt", "Select key to decrypt this message."),
                    cInfo.getEncryptionType(),
                    forSiganture);
              } catch (Exception e) {
                showError(Pooka.getProperty("Error.encryption.keystoreException", "Error selecting key:  "), e);
              }
            }
            // check the encryption

            if (key != null) {
              try {
                cInfo.decryptMessage(key, true);
              } catch (Exception e) {
                showError(Pooka.getProperty("Error.encryption.decryptionFailed", "Decryption Failed:  "), e);
              }

              MessageUI ui = getMessageUI();
View Full Code Here


   */
  public void checkSignature() {
  final boolean forSignature = true;
    MessageInfo info = getMessageInfo();
    if (info != null) {
      MessageCryptoInfo cInfo = info.getCryptoInfo();
      try {
        if (cInfo != null && cInfo.isSigned()) {
          CryptoStatusDisplay csd = null;

          String fromString = "";
          Address[] fromAddr = getMessageInfo().getMessage().getFrom();
          if (fromAddr != null && fromAddr.length > 0) {
            fromString = ((javax.mail.internet.InternetAddress)fromAddr[0]).getAddress();
          }
          java.security.Key[] keys = Pooka.getCryptoManager().getPublicKeys(
              fromString, cInfo.getEncryptionType(), true);

          if (keys == null || keys.length < 1) {
            java.security.Key newKey = selectPublicKey(
                Pooka.getProperty("Pooka.crypto.publicKey.forSig", "Select key for verifying the signature on this message."),
                cInfo.getEncryptionType(),
                forSignature);
            keys = new java.security.Key[] { newKey };
          }

          if (keys != null) {
            boolean checked = false;
            for (int i = 0; (! checked) && i < keys.length; i++) {
              checked = cInfo.checkSignature(keys[i], true);
              if(checked)
                break;
            }
          }
          MessageUI ui = getMessageUI();
View Full Code Here

   * Imports the keys on this message.
   */
  public void importKeys() {
    MessageInfo info = getMessageInfo();
    if (info != null) {
      MessageCryptoInfo cInfo = info.getCryptoInfo();
      if (cInfo != null) {
        try {
          java.security.Key[] newKeys = cInfo.extractKeys();
          if (newKeys != null && newKeys.length > 0) {
            // check to see if these match our current keys.
            String changedMessage = Pooka.getProperty("Pooka.crypto.importKeysMessage", "Import the following keys:") + "\n";

            for (int i = 0; i < newKeys.length; i++) {
View Full Code Here

              layout.putConstraint(SpringLayout.WEST, cp, BORDER, SpringLayout.EAST, headerScrollPane);
              layout.putConstraint(SpringLayout.NORTH, cp, BORDER, SpringLayout.NORTH, ReadMessageDisplayPanel.this);
              layout.getConstraints(headerScrollPane).setWidth(Spring.sum(layout.getConstraints(editorScrollPane).getWidth(), Spring.minus(Spring.sum(Spring.constant(BORDER), layout.getConstraints(cp).getWidth()))));

              MessageCryptoInfo cryptoInfo = getMessageProxy().getMessageInfo().getCryptoInfo();
              if (cryptoInfo != null)
                cp.cryptoUpdated(cryptoInfo);

              ReadMessageDisplayPanel.this.add(cp);
            }
View Full Code Here

TOP

Related Classes of net.suberic.pooka.MessageCryptoInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.