forsyth20100810-230642ca81116 years agoHistory
142 lines · 3.5 KB · Text
RawDownload
.TH CRYPT-CRYPT 2.SH NAMEcrypt: aessetup, aescbc, dessetup, descbc, desecb, ideasetup, ideacbc, ideaecb \- data encryption.SH SYNOPSIS.EXinclude "ipints.m";include "crypt.m";crypt := load Crypt Crypt->PATH; Encrypt:   con 0;Decrypt:   con 1; AESbsize:  con 16; aessetup:  fn(key: array of byte, ivec: array of byte): ref AESstate;aescbc:    fn(state: ref AESstate, buf: array of byte,             n: int, direction: int); BFbsize: con 8; blowfishsetup: fn(key: array of byte, ivec: array of byte): ref BFstate;blowfishcbc:   fn(state: ref BFstate, buf: array of byte,             n: int, direction: int); DESbsize:  con 8; dessetup:  fn(key: array of byte, ivec: array of byte): ref DESstate;descbc:    fn(state: ref DESstate, buf: array of byte,             n: int, direction: int);desecb:    fn(state: ref DESstate, buf: array of byte,             n: int, direction: int); IDEAbsize: con 8; ideasetup: fn(key: array of byte, ivec: array of byte): ref IDEAstate;ideacbc:   fn(state: ref IDEAstate, buf: array of byte,             n: int, direction: int);ideaecb:   fn(state: ref IDEAstate, buf: array of byte,             n: int, direction: int);.EE.SH DESCRIPTIONThese functions encrypt and decrypt blocks of data using differentencryption algorithms.The interfaces are similar..PPEach algorithm has an adt that holds the current state for a given encryption.It is produced by the setup function for the algorithm,.IB alg setup ,which is given a secret.I keyand an initialisation vector.IR ivec .A sequence of blocks of data can then be encrypted or decrypted by repeatedly calling.IB alg cbc(for `cipher block chaining'), or.IB alg ebc(the less secure `electronic code book', if provided).On each call,.I bufprovides.I nbytes of the data to encrypt or decrypt..I Nmust be a multiple of the encryption block size.IB ALG bsize .Exceptionally,.B aescbcallows.I nto be other than a multiple of.B AESbsizein length, but thenfor successful decryption, the decryptor must use the samesequence of buffer sizes as the encryptor..I Directionis the constant.B Encryptor.B Decryptas required..I Statemaintains the encryption state, initially produced by the setup function,and updated as each buffer is encrypted or decrypted..PPThe algorithms currently available are:.TP.B aesThe Advanced Encryption Standard, AES (also known as Rijndael).The.I keyshould be 16, 24 or 32 bytes long (128, 192 or 256 bits)..I Ivecshould be.B AESbsizebytes of random data: random enough to be unlikely to be reused butnot cryptographically strongly unpredictable..TP.B blowfishBruce Schneier's symmetric block cipher.The.I keyis any length from 4 to 56 bytes..I Ivecif non-nil is.B BFbsizebytes of random data.For.BR blowfishcbc ,.I nmust be a multiple of.BR BFbsize ..TP.B desThe older Data Encryption Standard, DES..I Keyis 8 bytes (64 bits), containing a 56-bit keyencoded into 64 bits where every eighth bit is parity..I Ivecis.B DESbsizebytes of random data..TP.B ideaThe International Data Encryption Standard, IDEA™.The.I keyis 16 bytes long (128 bits)..I Ivecis.B IDEAbsizebytes of random data..SH SEE ALSO.IR crypt-intro (2),.IR crypt-rc4 (2),.IR security-random (2).PPIDEA was patented by Ascom-Tech AG (EP 0 482 154 B1, US005214703),currently held by iT_SEC Systec Ltd.At time of writing, there was no licence fee required for noncommercial usebut checkthe current licensing policy of iT_SEC Systec Ltd,especially for commercial use.