Package com.valhalla.misc

Examples of com.valhalla.misc.GnuPG


                        .equals(tempSettings.getProperty("gpgApplication")))) {
            String command = tempSettings.getProperty("gpgApplication");
            if (command.equals("!!EMPTY!!"))
                command = "gpg";
            // check to make sure GnuPG is executable
            GnuPG gnupg = new GnuPG(command);
            boolean enabled = gnupg.listKeys("");
            if (!enabled) {
                Standard.warningMessage(prefs, "GnuPG Error",
                        "Invalid GPG path, GPG settings not applied.");
                tempSettings.setProperty("gpgApplication", Settings
                        .getInstance().getProperty("gpgApplication"));
View Full Code Here


    /**
     * Checks if GPG is enabled.
     */
    public static void checkGPG() {
        // check to make sure GnuPG is executable
        GnuPG gnupg = new GnuPG();
        gnupgEnabled = gnupg.listKeys("");
    }
View Full Code Here

            Settings.createKioskRoom();
        }
        JBother.profileDir = JBother.settingsDir + File.separatorChar
                + "profiles" + File.separatorChar + profile;

        GnuPG gnupg = new GnuPG();
        JBotherLoader.setGPGEnabled(gnupg.listKeys(""));

        String fontString = Settings.getInstance().getProperty(
                "applicationFont");
        if (fontString == null) {
            fontString = "Default-PLAIN-12";
        }

        Font newFont = Font.decode(fontString);
        com.valhalla.jbother.preferences.AppearancePreferencesPanel
                .updateApplicationFonts(newFont, null);
        ConversationFormatter.getInstance().switchTheme(
                Settings.getInstance().getProperty("emoticonTheme"));
        StatusIconCache.clearStatusIconCache();

        BuddyList.getInstance().loadSettings();
        JBotherLoader.loadSettings();

        if (JBotherLoader.isGPGEnabled()
                && Settings.getInstance().getBoolean("gnupgSavePassphrase")
                && Settings.getInstance().getProperty("gnupgSecretKeyID") != null) {
            String pass = Settings.getInstance().getProperty("gnupgPassPhrase");
            if (pass == null)
                pass = "";
            pass = SimpleXOR.decrypt(pass, "86753099672539");

            gnupg = new GnuPG();

            String gnupgSecretKeyID = Settings.getInstance().getProperty(
                    "gnupgSecretKeyID");

            if (gnupg.sign("1", gnupgSecretKeyID, pass)) {
                BuddyList.getInstance().setGnuPGPassword(pass);
            } else {
                BuddyList.getInstance().setGnuPGPassword(null);
                Standard.warningMessage(null, "GnuPG", resources
                        .getString("gnupgBadSavedPassword"));
View Full Code Here

        String gnupgPublicKey = buddy.getPubKey();
        if (JBotherLoader.isGPGEnabled() &&
        // BuddyList.getInstance().isEncrypting()
                buddy.isEncrypting() && (gnupgSecretKey != null)
                 && (gnupgPublicKey != null)) {
            GnuPG gnupg = new GnuPG();
            String encryptedData = null;
            String signedData = null;

            if (gnupgSecurityVariant == null) {
                gnupgSecurityVariant = "0";
                Settings.getInstance().setProperty("gnupgSecurityVariant", "0");
            }

            if ((gnupgSecurityVariant.equals("0"))
                     || (gnupgSecurityVariant.equals("1"))) {
                encryptedData = gnupg.encryptExtension(text, gnupgSecretKey,
                        gnupgPublicKey);
                if (encryptedData != null) {
                    secureExtension.setData(encryptedData);
                }
            }
            if ((gnupgSecurityVariant.equals("0"))
                     || (gnupgSecurityVariant.equals("2"))) {
                signedData = gnupg.signExtension(text, gnupgSecretKey);
                if (signedData != null) {
                    signedExtension.setData(signedData);
                }
            }

            if ((encryptedData == null) && (signedData == null)) {
                buddy.isEncrypting(false);
                encryptButton.setIcon(Standard.getIcon("images/buttons/ssl_no.png"));
                Standard.warningMessage(null,
                        resources.getString("gnupgError"), resources.getString("gnupgErrorEncrypting")
                         + ".\n\n"
                         + resources.getString("reason")
                         + ":\n\n"
                         + gnupg.getResult()
                         + gnupg.getErrorString()
                         + "\n"
                         + resources.getString("gnupgTryOrSendUnencrypted")
                         + ".");
                return false;
            }
View Full Code Here

    /**
     * Description of the Method
     */
    public void showDialog() {
        setTitle(resources.getString("gnupgKeySelector"));
        GnuPG gnupg = new GnuPG();
        boolean res = false;
        if (type.equals("sec")) {
            res = gnupg.listSecretKeys("");
        } else {
            res = gnupg.listKeys("");
        }

        if (!res) {
            Standard.warningMessage(null, "Error running GnuPG",
                    "Error running GnuPG: " + gnupg.getErrorString());
            return;
        }

        entries = gnupg.getResult().split("\n");
        for (int i = 0; i < entries.length; i++) {
            id = entries[i]
                    .replaceAll(
                            "^"
                                    + type
View Full Code Here

            }
        }

        else if ((gnupgSecretKey != null && JBotherLoader.isGPGEnabled())
                && (BuddyList.getInstance().getGnuPGPassword() == null)) {
            GnuPG gnupg = new GnuPG();
            while (true) {
                PasswordDialog dialog = new PasswordDialog(BuddyList.getInstance().getContainerFrame(),resources
                        .getString("gnupgKeyPassword"));
                gnupgTempPass = dialog.getText();
                if ((gnupgTempPass != null)
                        && (gnupg.sign("1", gnupgSecretKey, gnupgTempPass))) {
                    BuddyList.getInstance().setGnuPGPassword(gnupgTempPass);
                    break;
                } else {
                    BuddyList.getInstance().getStatusMenu()
                            .stopBlinkTimer();
View Full Code Here

                    }
                };
            }

            GnuPG gnupg = new GnuPG();
            String signedData = null;
            SecureExtension signedExtension = new SecureExtension( "signed" );
            String gnupgSecretKey = Settings.getInstance().getProperty(
                    "gnupgSecretKeyID" );

            if( JBotherLoader.isGPGEnabled()
                     && Settings.getInstance().getBoolean( "gnupgSignPresence" )
                     && gnupgSecretKey != null )
            {
                signedData = gnupg.signExtension( result, gnupgSecretKey );
                if( signedData != null )
                {
                    signedData = signedData.replaceAll( "(\n)+$", "" );
                    signedExtension.setData( signedData );
                    presence.addExtension( signedExtension );
View Full Code Here

        settings.setBoolean("useSSL", sslBox.isSelected());
        settings.setBoolean("autoLogin", autoLoginBox.isSelected());
        settings.setBoolean("reconnectOnDisconnect", reconnectBox.isSelected());
        if (gnupgSecretKeyID != null) {
            String gnupgTempPass = null;
            GnuPG gnupg = new GnuPG();
            boolean check = true;
            if (BuddyList.getInstance().checkConnection()
                    && !savepassphraseCheck.isSelected()
                    && gnupgSecretKeyID.matches(tempgnupgSecretKeyID) == false) {
                PasswordDialog d = new PasswordDialog(this,resources
                        .getString("gnupgKeyPassword"));
                gnupgTempPass = d.getText();
            } else if (savepassphraseCheck.isSelected()) {
                gnupgTempPass = new String(gnupgpasswordField.getPassword());
            } else {
                check = false;
            }

            if (!check
                    || ((gnupgTempPass != null) && (gnupg.sign("1",
                            gnupgSecretKeyID, gnupgTempPass)))) {
                BuddyList.getInstance().setGnuPGPassword(gnupgTempPass);
            } else {
                BuddyList.getInstance().setGnuPGPassword(null);
                Standard
View Full Code Here


        String[] entries;
        String name;
        String id;
        GnuPG gnupg = new GnuPG();
        id = settings.getProperty("gnupgSecretKeyID");
        if (id != null) {
            if (gnupg.listSecretKeys(id)) {
                entries = gnupg.getResult().split("\n");
                for (int i = 0; i < entries.length; i++) {
                    name = entries[i]
                            .replaceAll(
                                    "^sec:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:([^:]*):[^:]*:[^:]*:[^:]*$",
                                    "$1");
View Full Code Here

                        return;
                    }

                    String messageSbj = packet.getSubject();
                    String messageBody = packet.getBody();
                    GnuPG gnupg = new GnuPG();
                    decryptedFlag = false;
                    verifiedFlag = false;
                    final SecureExtension xEncryptedExtension = (SecureExtension) packet
                            .getExtension("x", "jabber:x:encrypted");
                    if (xEncryptedExtension != null
                            && Settings.getInstance().getProperty(
                                    "gnupgSecretKeyID") != null) {
                        String decryptedMessageBody = gnupg
                                .decryptExtension(xEncryptedExtension.getData());
                        if (decryptedMessageBody != null) {
                            messageBody = decryptedMessageBody;
                            decryptedFlag = true;
                        } else {
                            messageBody = "[ "
                                    + resources
                                            .getString("gnupgErrorDecrypting")
                                    + ". "
                                    + resources.getString("reason")
                                    + ":\n "
                                    + gnupg.getErrorString().replaceAll("\n",
                                            " ") + " ]";
                        }
                    }

                    final SecureExtension xSignedExtension = (SecureExtension) packet
                            .getExtension("x", "jabber:x:signed");
                    if (xSignedExtension != null) {
                        String verifiedMessageId = gnupg.verifyExtension(
                                xSignedExtension.getData(), messageBody);

                        if (verifiedMessageId != null) {
                            verifiedMessageId = verifiedMessageId.replaceAll(
                                    "\n$", "");
View Full Code Here

TOP

Related Classes of com.valhalla.misc.GnuPG

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.