| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title>DCPcrypt v2: Users Guide - Block Ciphers</title> |
| 4 |
</head> |
| 5 |
<body> |
| 6 |
<p align="center"><font size="+2"><b>DCPcrypt Cryptographic Component Library v2</b></font><br> |
| 7 |
<font size="+1">Copyright © 1999-2002 David Barton<br> |
| 8 |
<a href="http://www.cityinthesky.co.uk/">http://www.cityinthesky.co.uk/</a><br> |
| 9 |
<a href="mailto:[email protected]">[email protected]</a></font> |
| 10 |
<p><font size="+2">Block Ciphers - TDCP_blockcipher</font> |
| 11 |
<p>All block ciphers are inherited from the TDCP_blockcipher component via either the TDCP_blockcipher64 and TDCP_blockcipher128 components (the latter implement the block size specific code). |
| 12 |
<p>The TDCP_blockcipher component extends the TDCP_cipher component to provide chaining mode functions. Functions available are: |
| 13 |
<pre> |
| 14 |
property <a href="Ciphers.html#Initialized">Initialized</a>: boolean; |
| 15 |
property <a href="Ciphers.html#Id">Id</a>: integer; |
| 16 |
property <a href="Ciphers.html#Algorithm">Algorithm</a>: string; |
| 17 |
property <a href="Ciphers.html#MaxKeySize">MaxKeySize</a>: integer; |
| 18 |
property <a href="#BlockSize">BlockSize</a>: integer; |
| 19 |
property <a href="#CipherMode">CipherMode</a>: TDCP_ciphermode; |
| 20 |
|
| 21 |
class function <a href="Ciphers.html#SelfTest">SelfTest</a>: boolean; |
| 22 |
|
| 23 |
procedure <a href="#SetIV">SetIV</a>(const Value); |
| 24 |
procedure <a href="#GetIV">GetIV</a>(var Value); |
| 25 |
|
| 26 |
procedure <a href="Ciphers.html#Init">Init</a>(const Key; Size: longword; InitVector: pointer); |
| 27 |
procedure <a href="Ciphers.html#InitStr">InitStr</a>(const Key: string; HashType: TDCP_hashclass); |
| 28 |
procedure <a href="Ciphers.html#Burn">Burn</a>; |
| 29 |
procedure <a href="Ciphers.html#Reset">Reset</a>; |
| 30 |
procedure <a href="Ciphers.html#Encrypt">Encrypt</a>(const Indata; var Outdata; Size: longword); |
| 31 |
procedure <a href="Ciphers.html#Decrypt">Decrypt</a>(const Indata; var Outdata; Size: longword); |
| 32 |
function <a href="Ciphers.html#EncryptStream">EncryptStream</a>(InStream, OutStream: TStream; Size: longword): longword; |
| 33 |
function <a href="Ciphers.html#DecryptStream">DecryptStream</a>(InStream, OutStream: TStream; Size: longword): longword; |
| 34 |
function <a href="Ciphers.html#EncryptString">EncryptString</a>(const Str: string): string; |
| 35 |
function <a href="Ciphers.html#DecryptString">DecryptString</a>(const Str: string): string; |
| 36 |
procedure <a href="#EncryptECB">EncryptECB</a>(const Indata; var Outdata); |
| 37 |
procedure <a href="#DecryptECB">DecryptECB</a>(const Indata; var Outdata); |
| 38 |
procedure <a href="#EncryptCBC">EncryptCBC</a>(const Indata; var Outdata; Size: longword); |
| 39 |
procedure <a href="#DecryptCBC">DecryptCBC</a>(const Indata; var Outdata; Size: longword); |
| 40 |
procedure <a href="#EncryptCFB8bit">EncryptCFB8bit</a>(const Indata; var Outdata; Size: longword); |
| 41 |
procedure <a href="#DecryptCFB8bit">DecryptCFB8bit</a>(const Indata; var Outdata; Size: longword); |
| 42 |
procedure <a href="#EncryptCFBblock">EncryptCFBblock</a>(const Indata; var Outdata; Size: longword); |
| 43 |
procedure <a href="#DecryptCFBblock">DecryptCFBblock</a>(const Indata; var Outdata; Size: longword); |
| 44 |
procedure <a href="#EncryptOFB">EncryptOFB</a>(const Indata; var Outdata; Size: longword); |
| 45 |
procedure <a href="#DecryptOFB">DecryptOFB</a>(const Indata; var Outdata; Size: longword); |
| 46 |
procedure <a href="#EncryptCTR">EncryptCTR</a>(const Indata; var Outdata; Size: longword); |
| 47 |
procedure <a href="#DecryptCTR">DecryptCTR</a>(const Indata; var Outdata; Size: longword); |
| 48 |
</pre> |
| 49 |
<hr> |
| 50 |
<p><font size="+2">Function descriptions</font> |
| 51 |
<p><font size="+1"><a name="BlockSize">property BlockSize: integer;</a></font> |
| 52 |
<p>This contains the block size of the cipher in BITS. |
| 53 |
<p><font size="+1"><a name="CipherMode">property CipherMode: TDCP_ciphermode;</a></font> |
| 54 |
<p>This is the current chaining mode used when <a href="Ciphers.html#Encrypt">Encrypt</a> is called. The available modes are: |
| 55 |
<ul> |
| 56 |
<li>cmCBC - Cipher block chaining. |
| 57 |
<li>cmCFB8bit - 8bit cipher feedback. |
| 58 |
<li>cmCFBblock - Cipher feedback (using the block size of the algorithm). |
| 59 |
<li>cmOFB - Output feedback. |
| 60 |
<li>cmCTR - Counter. |
| 61 |
</ul> |
| 62 |
<p>Each chaining mode has it's own pro's and cons. See any good book on cryptography or the NIST publication SP800-38A for details on each. |
| 63 |
<p><font size="+1"><a name="SetIV">procedure SetIV(const Value);</a></font> |
| 64 |
<p>Use this procedure to set the current chaining mode information to Value. This variable should be the same size as the block size. When <a href="Ciphers.html#Reset">Reset</a> is called subsequent to this, the chaining information will be set back to Value. |
| 65 |
<p><font size="+1"><a name="GetIV">procedure GetIV(var Value);</a></font> |
| 66 |
<p>This returns in Value the current chaining mode information, to get the initial chaining mode information you need to call <a href="Ciphers.html#Reset">Reset</a> before calling GetIV. The variable passed in Value must be at least the same size as the block size otherwise you will get a buffer overflow. |
| 67 |
<p><font size="+1"><a name="EncryptCBC">procedure EncryptCBC(const Indata; var Outdata; Size: longword);</a></font><br> |
| 68 |
<font size="+1"><a name="DecryptCBC">procedure DecryptCBC(const Indata; var Outdata; Size: longword);</a></font><br> |
| 69 |
<font size="+1"><a name="EncryptCFB8bit">procedure EncryptCFB8bit(const Indata; var Outdata; Size: longword);</a></font><br> |
| 70 |
<font size="+1"><a name="DecryptCFB8bit">procedure DecryptCFB8bit(const Indata; var Outdata; Size: longword);</a></font><br> |
| 71 |
<font size="+1"><a name="EncryptCFBblock">procedure EncryptCFBblock(const Indata; var Outdata; Size: longword);</a></font><br> |
| 72 |
<font size="+1"><a name="DecryptCFBblock">procedure DecryptCFBblock(const Indata; var Outdata; Size: longword);</a></font><br> |
| 73 |
<font size="+1"><a name="EncryptOFB">procedure EncryptOFB(const Indata; var Outdata; Size: longword);</a></font><br> |
| 74 |
<font size="+1"><a name="DecryptOFB">procedure DecryptOFB(const Indata; var Outdata; Size: longword);</a></font><br> |
| 75 |
<font size="+1"><a name="EncryptCTR">procedure EncryptCTR(const Indata; var Outdata; Size: longword);</a></font><br> |
| 76 |
<font size="+1"><a name="DecryptCTR">procedure DecryptCTR(const Indata; var Outdata; Size: longword);</a></font> |
| 77 |
<p>These procedures encrypt/decrypt Size bytes of data from Indata and places the result in Outdata. These all employ chaining mode methods of encryption/decryption and so may need to be used inconjunction with <a href="Ciphers.html#Reset">Reset</a>. The CBC method uses short block encryption as specified in Bruce Schneier's "Applied Cryptography" for data blocks that are not multiples of the block size. |
| 78 |
<p> |
| 79 |
<p><a href="Index.html">Index</a>, <a href="Ciphers.html">Ciphers</a>, <a href="Hashes.html">Hashes</a> |
| 80 |
<p> |
| 81 |
<p><em>DCPcrypt is copyrighted © 1999-2002 David Barton.<br> |
| 82 |
All trademarks are property of their respective owners.</em> |
| 83 |
</body> |
| 84 |
</html> |