Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
Ciphers


NAME

Ciphers - general abstraction for crypto systems

SYNOPSIS

TYPE Cipher = POINTER TO CipherRec;
TYPE CipherRec = RECORD (PersistentDisciplines.ObjectRec) END; 
TYPE CryptProc = PROCEDURE (in: Streams.Stream; key: Cipher; 
                            length: INTEGER; out: Streams.Stream) : BOOLEAN;
TYPE Interface = POINTER TO InterfaceRec;
TYPE InterfaceRec = 
   RECORD
      (Objects.ObjectRec)
      encrypt, decrypt : CryptProc;
   END;
PROCEDURE Init(key: Cipher; if: Interface);
PROCEDURE Encrypt(in: Streams.Stream; key: Cipher; 
                  out: Streams.Stream) : BOOLEAN;
PROCEDURE Decrypt(in: Streams.Stream; key: Cipher; 
                  out: Streams.Stream) : BOOLEAN;
PROCEDURE EncryptPart(in: Streams.Stream; key: Cipher; 
                      length: INTEGER; out: Streams.Stream) : BOOLEAN;
PROCEDURE DecryptPart(in: Streams.Stream; key: Cipher; 
                      length: INTEGER; out: Streams.Stream) : BOOLEAN;

DESCRIPTION

Ciphers defines a general abstraction for the use of cryptographic methods.

An implementation of Ciphers must provide two procedures for encrypting and decrypting streams. Neither encrypt nor decrypt may be given as NIL. Init connects these methods by the interface if with the cipher key. Note that an implementation of a specific crypto system should not directly depend on Ciphers but instead on more appropriate abstractions like AsymmetricCiphers, BlockCiphers or StreamCiphers.

Encrypt encrypts the stream in using the cipher key and writes the output onto the stream out. Decrypt decrypts the stream in. EncryptPart and DecryptPart operate only on the next length bytes of the input stream. In case of any error FALSE is returned, otherwise TRUE.

SEE ALSO

AsymmetricCiphers
abstraction for the use of public key ciphers
BlockCiphers
abstraction for the use of block ciphers
PersistentObjects
abstraction for persistent objects
StreamCiphers
abstraction for the use of stream ciphers

AUTHOR

Michael Szczuka, University of Ulm
Edited by: borchert, last change: 1996/09/17, revision: 1.2, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module