Post a reply

Write your message and submit

Options

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

colddata
2011-10-24 23:25:58

The secret key must be first imported into the key ring along with the corresponding public key. GPG will pull up the secret key during decoding via the name of the recipient that is the name of the public key.

MARC
2008-11-11 22:30:15

I am getting the following error message

gpg: decryption failed: secret key not available
gpg: Signature made 10/15/08 16:08:01 using DSA key ID xxxxx
gpg: Good signature from "xxxxxxxx"
gpg: decryption failed: secret key not available
gpg: Signature made dddd using DSA key ID xxxxx
gpg: Good signature from "xxxxxxxx"

Where do we state wich secret key to use ?

MARC
2008-09-30 17:37:28

Here is the source code :

/**
* [tGPGDecrypt_1 begin ] start
*/



ok_Hash.put("tGPGDecrypt_1", false);
start_Hash.put("tGPGDecrypt_1", System.currentTimeMillis());
currentComponent="tGPGDecrypt_1";


            String[] cmdArray_tGPGDecrypt_1 = new String[]{
                                            "C:\App\gpg4win\GnuPG",
                                            "--yes",
                                            "-q",
                                            "-d",
                                            "--passphrase",
                                            "@rrq ver mrq pour le projet iqee1",
                                            "-o",
                                            "C:/App/ETL/IQEE_RRQ/data/outdecrypt",
                                            "TRACE.TXT.gpg"
                                             };
           
            Runtime runtime_tGPGDecrypt_1 = Runtime.getRuntime();
            final Process ps_tGPGDecrypt_1 = runtime_tGPGDecrypt_1.exec(cmdArray_tGPGDecrypt_1);
            Thread normal_tGPGDecrypt_1 = new Thread() {

                public void run() {
                    try {
                        java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(ps_tGPGDecrypt_1
                                .getInputStream()));
                        String line = "";
                        try {
                            while ((line = reader.readLine()) != null) {
                                System.out.println(line);
                            }
                        } finally {
                            reader.close();
                        }
                    } catch (java.io.IOException ioe) {
                        ioe.printStackTrace();
                    }
                }
            };
            normal_tGPGDecrypt_1.start();

            Thread error_tGPGDecrypt_1 = new Thread() {

                public void run() {
                    try {
                        java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(ps_tGPGDecrypt_1
                                .getErrorStream()));
                        String line = "";
                        try {
                            while ((line = reader.readLine()) != null) {
                                System.err.println(line);
                            }
                        } finally {
                            reader.close();
                        }
                    } catch (java.io.IOException ioe) {
                        ioe.printStackTrace();
                    }
                }
            };
            error_tGPGDecrypt_1.start();

            ps_tGPGDecrypt_1.waitFor();
            normal_tGPGDecrypt_1.join(10000);
            error_tGPGDecrypt_1.join(10000);
           
            java.io.File file_tGPGDecrypt_1 = new java.io.File("C:/App/ETL/IQEE_RRQ/data/outdecrypt");
            globalMap.put("tGPGDecrypt_1_FILE", file_tGPGDecrypt_1.getName());
            globalMap.put("tGPGDecrypt_1_FILEPATH", file_tGPGDecrypt_1.getPath());


/**
* [tGPGDecrypt_1 begin ] stop
*/
/**
* [tGPGDecrypt_1 main ] start
*/


currentComponent="tGPGDecrypt_1";




/**
* [tGPGDecrypt_1 main ] stop
*/
   Thread.sleep(1000);
/**
* [tGPGDecrypt_1 end ] start
*/


currentComponent="tGPGDecrypt_1";



ok_Hash.put("tGPGDecrypt_1", true);
end_Hash.put("tGPGDecrypt_1", System.currentTimeMillis());



/**
* [tGPGDecrypt_1 end ] stop
*/

   
    } catch(Exception e) {
       
        throw new TalendException(this, e);       
    }
   
   
    globalMap.put("tGPGDecrypt_1_SUBPROCESS_STATE", 1);
}    public static boolean watch = false;
    public static int portStats = 3334;
    public static int portTraces = 4334;
    public static String clientHost;
    public static String defaultClientHost = "localhost";
    public static String contextStr = "Default";
    public static String pid = "0";
    public static String rootPid = null;
    public static String fatherPid = null;
    public static long startTime = 0;

    private static ThreadLocal threadLocal = new ThreadLocal();

    private static java.util.Properties context_param = new java.util.Properties();

    public static String status = "";

    public static void main(String[] args) {

        int exitCode = runJobInTOS(args);

        globalBuffer.clear();

        System.exit(exitCode);
    }

    public static String[][] runJob(String[] args) {

        int exitCode = runJobInTOS(args);
        String[][] bufferValue = new String[][] { { Integer.toString(exitCode) } };

        globalBuffer.clear();

        return bufferValue;
    }

    public static synchronized int runJobInTOS(String[] args) {

        init();

        String lastStr = "";
        for (String arg : args) {
            if (arg.equalsIgnoreCase("--context_param")) {
                lastStr = arg;
            } else if (lastStr.equals("")) {
                evalParam(arg);
            } else {
                evalParam(lastStr + " " + arg);
                lastStr = "";
            }
        }

        if (clientHost == null) {
            clientHost = defaultClientHost;
        }

        pid = TalendString.getAsciiRandomString(6);
        if (rootPid == null) {
            rootPid = pid;
        }
        if (fatherPid == null) {
            fatherPid = pid;
        }

        try {
            java.io.InputStream inContext = DECRYPT_FI.class
                    .getClassLoader()
                    .getResourceAsStream(
                            "rrq_flux/decrypt_fi_0_1/contexts/Default.properties");
            if (inContext != null) {
                defaultProps.load(inContext);
                inContext.close();
                context = new ContextProperties(defaultProps);
            }

            if (contextStr.compareTo("Default") != 0) {
                inContext = DECRYPT_FI.class.getClassLoader()
                        .getResourceAsStream(
                                "rrq_flux/decrypt_fi_0_1/contexts/"
                                        + contextStr + ".properties");
                if (inContext != null) {
                    context.load(inContext);
                    inContext.close();
                }
            }

            if (!context_param.isEmpty()) {
                context.putAll(context_param);
            }

        } catch (java.io.IOException ie) {
            System.err.println("Could not load context " + contextStr);
            ie.printStackTrace();
        }

        try {
            runStat.startThreadStat(clientHost, portStats);
        } catch (java.io.IOException ioException) {
            ioException.printStackTrace();
        }

        try {
            runTrace.startThreadTrace(clientHost, portTraces);
        } catch (java.io.IOException ioException) {
            ioException.printStackTrace();
        }

        long startUsedMemory = Runtime.getRuntime().totalMemory()
                - Runtime.getRuntime().freeMemory();
        long endUsedMemory = 0;
        long end = 0;

        startTime = System.currentTimeMillis();
        final DECRYPT_FI DECRYPT_FIClass = new DECRYPT_FI();

        try {
            errorCode = null;
            DECRYPT_FIClass.tGPGDecrypt_1Process(globalMap);
            status = "end";
        } catch (TalendException e_tGPGDecrypt_1) {
            status = "failure";
            e_tGPGDecrypt_1.printStackTrace();
            globalMap.put("tGPGDecrypt_1_SUBPROCESS_STATE", -1);

        } finally {
        }

        end = System.currentTimeMillis();

        if (watch) {
            System.out.println((end - startTime) + " milliseconds");
        }

        endUsedMemory = Runtime.getRuntime().totalMemory()
                - Runtime.getRuntime().freeMemory();
        if (false) {
            System.out.println((endUsedMemory - startUsedMemory)
                    + " bytes memory increase when running : DECRYPT_FI");
        }

        runStat.stopThreadStat();
        runTrace.stopThreadTrace();

        reset();

        if (errorCode == null) {
            return status != null && status.equals("failure") ? 1 : 0;
        } else {
            return errorCode.intValue();
        }
    }

    public static void evalParam(String arg) {
        if (arg.startsWith("--watch")) {
            watch = true;
        } else if (arg.startsWith("--stat_port=")) {
            portStats = Integer.parseInt(arg.substring(12));
        } else if (arg.startsWith("--trace_port=")) {
            portTraces = Integer.parseInt(arg.substring(13));
        } else if (arg.startsWith("--client_host=")) {
            clientHost = arg.substring(14);
        } else if (arg.startsWith("--context=")) {
            contextStr = arg.substring(10);
        } else if (arg.startsWith("--father_pid=")) {
            fatherPid = arg.substring(13);
        } else if (arg.startsWith("--root_pid=")) {
            rootPid = arg.substring(11);
        } else if (arg.startsWith("--context_param")) {
            String keyValue = arg.substring(16);
            int index = -1;
            if (keyValue != null && (index = keyValue.indexOf('=')) > -1) {
                context_param.put(keyValue.substring(0, index), keyValue
                        .substring(index + 1));
            }
        }

    }

    private static void init() {
        errorCode = null;
        status = "";
    }

    private static void reset() {

        defaultProps.clear();
        context.clear();

        threadLocal = new ThreadLocal();
        currentComponent = "";
        start_Hash.clear();
        end_Hash.clear();
        ok_Hash.clear();
        globalMap.clear();
        watch = false;
        portStats = 3334;
        portTraces = 4334;
        clientHost = null;
        defaultClientHost = "localhost";
        contextStr = "Default";
        pid = "0";
        rootPid = null;
        fatherPid = null;
        context_param.clear();
        System.gc();
    }
}
/************************************************************************************************
* 13751 characters generated by Talend OpenStudio on the 30 septembre 2008
* 11:28:49 EDT
************************************************************************************************/

The error is found on this line : "C:\App\gpg4win\GnuPG",

Here is the run error message I get :

Starting job DECRYPT_FI at 11:36 30/09/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    Invalid escape sequence (valid ones are  \b  \t  \n  \f  \r  \"  \'  \\ )

    at rrq_flux.decrypt_fi_0_1.DECRYPT_FI.tGPGDecrypt_1Process(DECRYPT_FI.java:153)
    at rrq_flux.decrypt_fi_0_1.DECRYPT_FI.runJobInTOS(DECRYPT_FI.java:377)
    at rrq_flux.decrypt_fi_0_1.DECRYPT_FI.main(DECRYPT_FI.java:279)
[statistics] connecting to socket on port 4032
[statistics] connected
[trace] connecting to socket on port 4650
[trace] connected
Job DECRYPT_FI ended at 11:36 30/09/2008. [exit code=0]

MARC
2008-09-30 17:15:07

Now I get the following error :

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    Syntax error on token(s), misplaced construct(s)
    Syntax error on tokens, delete these tokens
    cmdArray_tGPGDecrypt_1 cannot be resolved

    at rrq_flux.decrypt_fi_0_1.DECRYPT_FI.tGPGDecrypt_1Process(DECRYPT_FI.java:152)
    at rrq_flux.decrypt_fi_0_1.DECRYPT_FI.runJobInTOS(DECRYPT_FI.java:366)
    at rrq_flux.decrypt_fi_0_1.DECRYPT_FI.main(DECRYPT_FI.java:278)

MARC
2008-09-29 16:40:20

I am getting the following error :

Starting job DECRYPT_FI at 10:35 29/09/2008.
gpg: decryption failed: secret key not available
Job DECRYPT_FI ended at 10:35 29/09/2008. [exit code=0]

There does not seem to have any interface to point to the appropriate secret key.

Board footer

Powered by FluxBB