gnu.crypto.key

Class OutgoingMessage


public class OutgoingMessage
extends Object

An implementation of outgoing messages for use with key agreement protocols.
Version:
$Revision: 1.2 $

Constructor Summary

OutgoingMessage()

Method Summary

byte[]
toByteArray()
Returns the encoded form of the current message including the 4-byte length header.
byte[]
wrap()
Returns the encoded form of the current message excluding the 4-byte length header.
void
writeMPI(BigInteger val)
Encodes an MPI into the message.
void
writePrivateKey(PrivateKey k)
Encodes a private key into the message.
void
writePublicKey(PublicKey k)
Encodes a public key into the message.
void
writeString(String s)
Encodes a string into the message.

Constructor Details

OutgoingMessage

public OutgoingMessage()

Method Details

toByteArray

public byte[] toByteArray()
            throws KeyAgreementException
Returns the encoded form of the current message including the 4-byte length header.
Throws:
KeyAgreementException - if an encoding size constraint is violated.

wrap

public byte[] wrap()
            throws KeyAgreementException
Returns the encoded form of the current message excluding the 4-byte length header.
Throws:
KeyAgreementException - if an encoding size constraint is violated.

writeMPI

public void writeMPI(BigInteger val)
            throws KeyAgreementException
Encodes an MPI into the message.
Parameters:
val - the MPI to encode.
Throws:
KeyAgreementException - if an encoding size constraint is violated.

writePrivateKey

public void writePrivateKey(PrivateKey k)
            throws KeyAgreementException
Encodes a private key into the message.
Parameters:
k - the private key to encode.
Throws:
KeyAgreementException - if an encoding size constraint is violated.

writePublicKey

public void writePublicKey(PublicKey k)
            throws KeyAgreementException
Encodes a public key into the message.
Parameters:
k - the public key to encode.
Throws:
KeyAgreementException - if an encoding size constraint is violated.

writeString

public void writeString(String s)
            throws KeyAgreementException
Encodes a string into the message.
Parameters:
s - the string to encode.
Throws:
KeyAgreementException - if the UTF8 encoding is not supported on this platform, or if an encoding size constraint is violated.

Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.