Cryptix OpenPGP

cryptix.message.stream
Class EncryptedMessageOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended bycryptix.message.stream.MessageOutputStream
          extended bycryptix.message.stream.EncryptedMessageOutputStream

public final class EncryptedMessageOutputStream
extends MessageOutputStream

A stream that encrypts another stream.

Version:
$Revision: 1.1 $
Author:
Edwin Woudt

Field Summary
 
Fields inherited from class cryptix.message.stream.MessageOutputStream
spi
 
Constructor Summary
protected EncryptedMessageOutputStream(MessageOutputStreamSpi spi, java.security.Provider provider, java.lang.String format)
          Create a new EncryptedMessageOutputStream object containing the given SPI object.
 
Method Summary
 void addRecipient(KeyBundle bundle)
          Adds a keybundle recipient
 void addRecipient(java.security.PublicKey publickey)
          Adds a public key recipient
 void addRecipient(javax.crypto.SecretKey symmetrickey)
          Adds a symmetric key recipient
 void addRecipient(java.lang.String passphrase)
          Adds a passphrase recipient
static EncryptedMessageOutputStream getInstance(java.lang.String format)
          Returns an EncryptedMessageOutputStream that implements the given format.
static EncryptedMessageOutputStream getInstance(java.lang.String format, java.security.Provider provider)
          Returns an EncryptedMessageOutputStream from the given provider that implements the given format.
static EncryptedMessageOutputStream getInstance(java.lang.String format, java.lang.String provider)
          Returns an EncryptedMessageOutputStream from the given provider that implements the given format.
 
Methods inherited from class cryptix.message.stream.MessageOutputStream
close, flush, getFormat, getProvider, getSpi, init, setAttribute, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptedMessageOutputStream

protected EncryptedMessageOutputStream(MessageOutputStreamSpi spi,
                                       java.security.Provider provider,
                                       java.lang.String format)
Create a new EncryptedMessageOutputStream object containing the given SPI object.

Method Detail

getInstance

public static EncryptedMessageOutputStream getInstance(java.lang.String format)
                                                throws java.security.NoSuchAlgorithmException
Returns an EncryptedMessageOutputStream that implements the given format.

Throws:
java.security.NoSuchAlgorithmException

getInstance

public static EncryptedMessageOutputStream getInstance(java.lang.String format,
                                                       java.lang.String provider)
                                                throws java.security.NoSuchAlgorithmException,
                                                       java.security.NoSuchProviderException
Returns an EncryptedMessageOutputStream from the given provider that implements the given format.

Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException

getInstance

public static EncryptedMessageOutputStream getInstance(java.lang.String format,
                                                       java.security.Provider provider)
                                                throws java.security.NoSuchAlgorithmException
Returns an EncryptedMessageOutputStream from the given provider that implements the given format.

Throws:
java.security.NoSuchAlgorithmException

addRecipient

public final void addRecipient(java.security.PublicKey publickey)
                        throws java.lang.IllegalStateException,
                               java.lang.UnsupportedOperationException,
                               java.io.IOException,
                               MessageStreamException
Adds a public key recipient

Throws:
InvalidStateException - if this message has not been initialized properly or if data has already been streamed
java.lang.UnsupportedOperationException - if this particular format does not support encrypting messages to public keys.
java.io.IOException - on a general IOException that is not format specific.
MessageStreamException - on a variety of format specific problems.
java.lang.IllegalStateException

addRecipient

public final void addRecipient(KeyBundle bundle)
                        throws java.lang.IllegalStateException,
                               java.lang.UnsupportedOperationException,
                               java.io.IOException,
                               MessageStreamException
Adds a keybundle recipient

Throws:
InvalidStateException - if this message has not been initialized properly or if data has already been streamed
java.lang.UnsupportedOperationException - if this particular format does not support encrypting messages to public keys.
java.io.IOException - on a general IOException that is not format specific.
MessageStreamException - on a variety of format specific problems.
java.lang.IllegalStateException

addRecipient

public final void addRecipient(javax.crypto.SecretKey symmetrickey)
                        throws java.lang.IllegalStateException,
                               java.lang.UnsupportedOperationException,
                               java.io.IOException,
                               MessageStreamException
Adds a symmetric key recipient

Throws:
InvalidStateException - if this message has not been initialized properly or if data has already been streamed
java.lang.UnsupportedOperationException - if this particular format does not support encrypting messages to symmetric keys.
java.io.IOException - on a general IOException that is not format specific.
MessageStreamException - on a variety of format specific problems.
java.lang.IllegalStateException

addRecipient

public final void addRecipient(java.lang.String passphrase)
                        throws java.lang.IllegalStateException,
                               java.lang.UnsupportedOperationException,
                               java.io.IOException,
                               MessageStreamException
Adds a passphrase recipient

Throws:
InvalidStateException - if this message has not been initialized properly or if the build() method has been called
java.lang.UnsupportedOperationException - if this particular format does not support encrypting messages to passphrases.
java.io.IOException - on a general IOException that is not format specific.
MessageStreamException - on a variety of format specific problems.
java.lang.IllegalStateException

Cryptix OpenPGP

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