Oberon || Library || Module Index || Search Engine || Definition || Module
CONST composed = 0; isPrivateKey = 1; TYPE CapabilitySet = SET; TYPE Cipher = POINTER TO CipherRec; TYPE CipherRec = RECORD (BlockCiphers.CipherRec) END; TYPE SplitProc = PROCEDURE (VAR public: Cipher; key: Cipher); TYPE RandomStreamProc = PROCEDURE (s: Streams.Stream); TYPE Interface = POINTER TO InterfaceRec; TYPE InterfaceRec = RECORD (Ciphers.InterfaceRec) compencrypt : Ciphers.CryptProc; split : SplitProc; randomStream : RandomStreamProc; END; PROCEDURE Init (key: Cipher; if: Interface; cap: CapabilitySet; inLength, outLength: INTEGER); PROCEDURE Capabilities (key: Cipher) : CapabilitySet; PROCEDURE IsPublicKey (key: Cipher) : BOOLEAN; PROCEDURE Split (VAR public: Cipher; key: Cipher); PROCEDURE ComposedEncrypt (in: Streams.Stream; key: Cipher; out: Streams.Stream) : BOOLEAN; PROCEDURE ComposedEncryptPart (in: Streams.Stream; key: Cipher; length: INTEGER; out: Streams.Stream) : BOOLEAN; PROCEDURE ComposedEncryptBlock (in: Streams.Stream; key: Cipher; out: Streams.Stream) : BOOLEAN; PROCEDURE RandomStream(s: Streams.Stream; key: Cipher);
Apart from an encryption and a decryption method an implementation has to provide three other procedures for an asymmetric cipher: compencrypt is the composition of the encryption and decryption maps. For most public key systems this will be the identical map. In this case it may be given as NIL. split extracts the public part of a cipher. randomStream puts some random bytes onto the stream s which can be used as starting values for an encryption with the specific asymmetric cipher.
Init initializes the cipher key with the given interface if, the capabilities cap and the block lengths inlength and outLength.
Capabilites returns the capabilities of an asymmetric cipher. The supported capabilities are:
IsPublicKey returns TRUE if the cipher key is a public cipher, otherwise FALSE.
Split extracts the public part of the cipher key and returns it as a seperate cipher public. If key itself is a public cipher then public is set to key.
ComposedEncrypt, ComposedEncryptPart andComposedEncryptBlock encrypt the stream in using the composed map of the cipher key. If composed is not a capability of key then the identiy map is used instead. The use of these functions is similar to the use of Ciphers.Encrypt, Ciphers.EncryptPart and BlockCiphers.EncryptBlock.
RandomStream puts some random bytes onto the stream s. These can be used as the starting values of an encryption when the composed map of the cipher is not the identical map.
Oberon || Library || Module Index || Search Engine || Definition || Module