com.ark.pgp
Class PGPMessageAgent

java.lang.Object
  |
  +--com.ark.pgp.PGPMessageAgent

public class PGPMessageAgent
extends java.lang.Object

This is the client interface to all PGP message functions.


Constructor Summary
PGPMessageAgent(java.lang.String key_src, java.lang.String passphrase_str)
          Creates an OpenPGP message agent.
 
Method Summary
 byte[] decode(java.io.Reader src)
          Decodes an OpenPGP Public Key encrypted & signed message.
 byte[] decode(java.io.Reader src, java.lang.String passphrase)
          Decodes an OpenPGP Symmetric Key encrypted & signed message.
 void decodePKEncryptedFile(java.lang.String in_file, java.lang.String out_file)
          Decodes an OpenPGP Public Key encrypted & signed file.
 void decodeSKEncryptedFile(java.lang.String in_file, java.lang.String out_file, java.lang.String passphrase)
          Decodes an OpenPGP Symmetric Key encrypted & signed file.
 void encodePK(byte[] message, java.io.Writer writer, java.lang.String user)
          Creates an OpenPGP Public Key Encrypted & Signed message.
 void encodePKEncryptedFile(java.lang.String in_file, java.lang.String out_file, java.lang.String user)
          Encodes an OpenPGP Public Key encrypted & signed file.
 void encodeSK(byte[] message, java.io.Writer writer, java.lang.String passphrase)
          Creates an OpenPGP Symmetric Key Encrypted & Signed message.
 void encodeSKEncryptedFile(java.lang.String in_file, java.lang.String out_file, java.lang.String passphrase)
          Encodes an OpenPGP Symmetric Key encrypted & signed file.
static void main(java.lang.String[] args)
          Command-line tool to access SlimPGP functions.
 void signClearText(java.lang.String message, java.io.Writer writer)
          Signs a clear text message.
 void signClearTextFile(java.lang.String in_file, java.lang.String out_file)
          Signs a clear text file.
 java.lang.String verifyClearText(java.io.Reader src)
          Verifies the attached signature of a clear text message.
 void verifyClearTextFile(java.lang.String in_file, java.lang.String out_file)
          Verifies the attached signature of a clear text file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PGPMessageAgent

public PGPMessageAgent(java.lang.String key_src,
                       java.lang.String passphrase_str)
                throws java.lang.Exception
Creates an OpenPGP message agent.
Parameters:
key_src - Key ring file
passphrase_str - Passphrase to access the private key
Throws:
Thrown - when failed to create the message agent
Method Detail

decode

public byte[] decode(java.io.Reader src)
              throws java.lang.Exception
Decodes an OpenPGP Public Key encrypted & signed message.
Parameters:
src - The source message.
Returns:
The decoded message.
Throws:
Thrown - when either the decryption or the verification of the signature fails.

decode

public byte[] decode(java.io.Reader src,
                     java.lang.String passphrase)
              throws java.lang.Exception
Decodes an OpenPGP Symmetric Key encrypted & signed message.
Parameters:
src - The source message.
passphrase - The password to access the encrypted message
Returns:
The decoded message.
Throws:
Thrown - when either the decryption or the verification of the signature fails.

decodePKEncryptedFile

public void decodePKEncryptedFile(java.lang.String in_file,
                                  java.lang.String out_file)
                           throws java.lang.Exception
Decodes an OpenPGP Public Key encrypted & signed file.
Parameters:
in_file - The input file.
out_file - The output file.
Throws:
Thrown - when either the decryption or the verification of the signature fails.

decodeSKEncryptedFile

public void decodeSKEncryptedFile(java.lang.String in_file,
                                  java.lang.String out_file,
                                  java.lang.String passphrase)
                           throws java.lang.Exception
Decodes an OpenPGP Symmetric Key encrypted & signed file.
Parameters:
in_file - The input file.
out_file - The output file.
passphrase - The password to access the encrypted message
Throws:
Thrown - when either the decryption or the verification of the signature fails.

encodePK

public void encodePK(byte[] message,
                     java.io.Writer writer,
                     java.lang.String user)
              throws java.lang.Exception
Creates an OpenPGP Public Key Encrypted & Signed message.
Parameters:
message - The source message.
writer - The output of the encoded message.
user - The intended user of encoded message.
Throws:
Thrown - when either the encryption or the signing of the signature fails.

encodeSK

public void encodeSK(byte[] message,
                     java.io.Writer writer,
                     java.lang.String passphrase)
              throws java.lang.Exception
Creates an OpenPGP Symmetric Key Encrypted & Signed message.
Parameters:
message - The source message.
writer - The output of the encoded message.
passphrase - The password to access the encrypted message.
Throws:
Thrown - when either the encryption or the signing of the signature fails.

encodePKEncryptedFile

public void encodePKEncryptedFile(java.lang.String in_file,
                                  java.lang.String out_file,
                                  java.lang.String user)
                           throws java.lang.Exception
Encodes an OpenPGP Public Key encrypted & signed file.
Parameters:
in_file - The input file.
out_file - The output file.
user - The intended user of encoded message.
Throws:
Thrown - when either the encryption or the signing of the signature fails.

encodeSKEncryptedFile

public void encodeSKEncryptedFile(java.lang.String in_file,
                                  java.lang.String out_file,
                                  java.lang.String passphrase)
                           throws java.lang.Exception
Encodes an OpenPGP Symmetric Key encrypted & signed file.
Parameters:
in_file - The input file.
out_file - The output file.
passphrase - The password to access the encrypted message
Throws:
Thrown - when either the encryption or the signing of the signature fails.

verifyClearText

public java.lang.String verifyClearText(java.io.Reader src)
                                 throws java.lang.Exception
Verifies the attached signature of a clear text message.
Parameters:
src - The source message including the attached signature.
Returns:
The verified clear text with signature removed.
Throws:
Thrown - when the verification of the signature fails.

verifyClearTextFile

public void verifyClearTextFile(java.lang.String in_file,
                                java.lang.String out_file)
                         throws java.lang.Exception
Verifies the attached signature of a clear text file.
Parameters:
in_file - The source clear text file including the attached signature.
out_file - The output file with signature removed.
Throws:
Thrown - when the verification of the signature fails.

signClearText

public void signClearText(java.lang.String message,
                          java.io.Writer writer)
                   throws java.lang.Exception
Signs a clear text message.
Parameters:
src - The clear text message.
writer - The output of the the signed message.
Throws:
Thrown - when the signing fails.

signClearTextFile

public void signClearTextFile(java.lang.String in_file,
                              java.lang.String out_file)
                       throws java.lang.Exception
Signs a clear text file.
Parameters:
in_file - The clear text file to be signed.
out_file - The output of the the signed message.
Throws:
Thrown - when the signing fails.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Command-line tool to access SlimPGP functions.