Cryptix OpenPGP

cryptix.message
Class EncryptedMessage

java.lang.Object
  extended bycryptix.message.Message
      extended bycryptix.message.EncryptedMessage

public abstract class EncryptedMessage
extends Message

Represents an encrypted message.

Version:
$Revision: 1.4 $
Author:
Edwin Woudt

Constructor Summary
EncryptedMessage(java.lang.String format)
          Creates a EncryptedMessage of the specified format.
 
Method Summary
abstract  Message decrypt(char[] passphrase)
          Decrypt the message with a passphrase.
abstract  Message decrypt(java.security.Key key)
          Decrypt the message with a key.
abstract  Message decrypt(KeyBundle bundle, char[] passphrase)
          Decrypt the message with a keybundle, decrypting the private key in the keybundle using the given passphrase.
abstract  KeyID[] getKeyIDHints()
          Returns hints for which keys can be used to decrypt this message
 
Methods inherited from class cryptix.message.Message
equals, getAttribute, getEncoded, getFormat, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptedMessage

public EncryptedMessage(java.lang.String format)
Creates a EncryptedMessage of the specified format.

Method Detail

decrypt

public abstract Message decrypt(java.security.Key key)
                         throws NotEncryptedToParameterException,
                                MessageException,
                                java.lang.UnsupportedOperationException
Decrypt the message with a key.

For most formats this key will usually be an instance of PrivateKey (i.e. public key encryption was used). However, for some formats it could also be possible to pass in a SecretKey (i.e. symmetric key encryption was used).

Returns:
the decrypted message.
Throws:
NotEncryptedToParameterException - if the decryption failed because this message is not encrypted to that particular key.
MessageException - on a variety of format specific problems.
java.lang.UnsupportedOperationException - if this particular format does not support key based encryption.

decrypt

public abstract Message decrypt(KeyBundle bundle,
                                char[] passphrase)
                         throws NotEncryptedToParameterException,
                                MessageException,
                                java.lang.UnsupportedOperationException,
                                java.security.UnrecoverableKeyException
Decrypt the message with a keybundle, decrypting the private key in the keybundle using the given passphrase.

Returns:
the decrypted message.
Throws:
NotEncryptedToParameterException - if the decryption failed because this message is not encrypted to that particular key.
MessageException - on a variety of format specific problems.
java.lang.UnsupportedOperationException - if this particular format does not support key based encryption.
java.security.UnrecoverableKeyException - if the private key cannot be retrieved from the keybundle (for example because of an incorrect passphrase).

decrypt

public abstract Message decrypt(char[] passphrase)
                         throws NotEncryptedToParameterException,
                                MessageException,
                                java.lang.UnsupportedOperationException
Decrypt the message with a passphrase.

Returns:
the decrypted message.
Throws:
NotEncryptedToParameterException - if the decryption failed because this message is not encrypted to that particular passphrase.
MessageException - on a variety of format specific problems.
java.lang.UnsupportedOperationException - if this particular format does not support password based encryption.

getKeyIDHints

public abstract KeyID[] getKeyIDHints()
                               throws MessageException
Returns hints for which keys can be used to decrypt this message

Throws:
MessageException - on a variety of format specific problems.

Cryptix OpenPGP

Copyright (C) 1999-2003 The Cryptix Foundation Ltd.