gnu.crypto.mac

Class MacInputStream


public class MacInputStream
extends FilterInputStream

A filtering input stream that computes a MAC (message authentication code) over all data read from the stream.
Version:
$Revision: 1.2 $

Constructor Summary

MacInputStream(InputStream in, IMac mac)
Creates a new MacInputStream.

Method Summary

IMac
getMac()
Returns the MAC this stream is updating.
void
on(boolean flag)
Turns the digesting state on or off.
int
read()
int
read(byte[] buf, int off, int len)
void
setMac(IMac mac)
Sets the MAC this stream is updating, which must have already been initialized.

Constructor Details

MacInputStream

public MacInputStream(InputStream in,
                      IMac mac)
Creates a new MacInputStream. The stream is initially set to digest data written, the mac argument must have already been initialized, and the mac argument is not cloned.
Parameters:
in - The underlying input stream.
mac - The mac instance to use.

Method Details

getMac

public IMac getMac()
Returns the MAC this stream is updating.
Returns:
The MAC.

on

public void on(boolean flag)
Turns the digesting state on or off. When off, the MAC will not be updated when data is written to the stream.
Parameters:
flag - The new digesting state.

read

public int read()
            throws IOException

read

public int read(byte[] buf,
                int off,
                int len)
            throws IOException

setMac

public void setMac(IMac mac)
Sets the MAC this stream is updating, which must have already been initialized. The argument is not cloned by this method.
Parameters:
mac - The new MAC.

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