de.buelowssiege.mail.pgp_mime.gpg
Class GnuPGBodyPartSigner

java.lang.Object
  |
  +--de.buelowssiege.mail.pgp_mime.gpg.GnuPGExecuter
        |
        +--de.buelowssiege.mail.pgp_mime.gpg.GnuPGBodyPartSigner
All Implemented Interfaces:
BodyPartSigner, BodyPartVerifier

public class GnuPGBodyPartSigner
extends GnuPGExecuter
implements BodyPartSigner, BodyPartVerifier

This implementation of the BodyPartSigner and BodyPartVerifier uses the GnuPG program to construct or verify the signature.

Version:
$Id: GnuPGBodyPartSigner.html,v 1.1 2004/02/11 12:51:34 mschwerin Exp $
Author:
Maximilian Schwerin

Field Summary
 
Fields inherited from class de.buelowssiege.mail.pgp_mime.gpg.GnuPGExecuter
binaryPath, logger, RETURN_BAD_SIGNATURE, RETURN_OK
 
Constructor Summary
GnuPGBodyPartSigner(java.lang.String binaryPath)
          This constructor may only be used if we will only use the created instance to verify.
GnuPGBodyPartSigner(java.lang.String binaryPath, de.buelowssiege.mail.pgp_mime.PGPAuthenticator authenticator)
          Use this constructor if the instance is supposed to be used for signing.
 
Method Summary
 javax.mail.BodyPart getContentPart()
          Returns the content part that was set earlier.
 java.lang.String getMICAlg()
          Returns the name of the Message Integrity Check (MIC) Algorithm used by the signature creating process.
 javax.mail.BodyPart getSignaturePart()
          Returns the body part containing the control information necessary to verify the digital signature.
 java.lang.String getVerifyMessages()
          Returns the messages that are returned by GnuPG when verifying a signed multipart
 void setContentPart(javax.mail.BodyPart contentPart)
          Sets the content part that is to be signed.
 void setSignaturePart(javax.mail.BodyPart signaturePart)
          Sets the body part, that contains the signature created over the content part.
 void sign()
          This method does the actual signing.
 void verify()
          This method does the actual verifying.
 
Methods inherited from class de.buelowssiege.mail.pgp_mime.gpg.GnuPGExecuter
createTempFile, joinProcess, readBodyPart, sendPassPhrase, startProcess, updateHeaders, writeBodyPart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GnuPGBodyPartSigner

public GnuPGBodyPartSigner(java.lang.String binaryPath,
                           de.buelowssiege.mail.pgp_mime.PGPAuthenticator authenticator)
Use this constructor if the instance is supposed to be used for signing.


GnuPGBodyPartSigner

public GnuPGBodyPartSigner(java.lang.String binaryPath)
This constructor may only be used if we will only use the created instance to verify. To sign it is necessary to specify an authenticator.

Method Detail

sign

public void sign()
          throws javax.mail.MessagingException
This method does the actual signing. The content part must have been set before executing this method.

Specified by:
sign in interface BodyPartSigner
javax.mail.MessagingException

verify

public void verify()
            throws javax.mail.MessagingException
This method does the actual verifying. Both the content part and the signature part must have been set.

Specified by:
verify in interface BodyPartVerifier
javax.mail.MessagingException

setContentPart

public void setContentPart(javax.mail.BodyPart contentPart)
Sets the content part that is to be signed.

Specified by:
setContentPart in interface BodyPartSigner

getContentPart

public javax.mail.BodyPart getContentPart()
Returns the content part that was set earlier.

Specified by:
getContentPart in interface BodyPartSigner

setSignaturePart

public void setSignaturePart(javax.mail.BodyPart signaturePart)
Sets the body part, that contains the signature created over the content part.

Specified by:
setSignaturePart in interface BodyPartVerifier

getSignaturePart

public javax.mail.BodyPart getSignaturePart()
Returns the body part containing the control information necessary to verify the digital signature.

Specified by:
getSignaturePart in interface BodyPartSigner

getMICAlg

public java.lang.String getMICAlg()
Returns the name of the Message Integrity Check (MIC) Algorithm used by the signature creating process.

Specified by:
getMICAlg in interface BodyPartSigner

getVerifyMessages

public java.lang.String getVerifyMessages()
Returns the messages that are returned by GnuPG when verifying a signed multipart