This file is indexed.

/usr/share/doc/libghc-crypto-api-doc/html/Crypto-Padding.html is in libghc-crypto-api-doc 0.13.2-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Crypto.Padding</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Crypto-Padding.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Crypto-Padding.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">crypto-api-0.13.2: A generic interface for cryptographic operations</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Maintainer</th><td>Thomas.DuBuisson@gmail.com</td></tr><tr><th>Stability</th><td>beta</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Crypto.Padding</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">PKCS5 (RFC 1423) based [un]padding routines</a></li><li><a href="#g:2">ESP (RFC 4303) [un]padding routines</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>PKCS5 (RFC 1423) and IPSec ESP (RFC 4303)
padding methods are implemented both as trivial functions operating on
bytestrings and as <code><a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a></code> routines usable from the <a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize.html">Data.Serialize</a>
module.  These methods do not work for algorithms or pad sizes in
excess of 255 bytes (2040 bits, so extremely large as far as cipher
needs are concerned).</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:padPKCS5">padPKCS5</a> :: <a href="Crypto-Types.html#t:ByteLength">ByteLength</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:padBlockSize">padBlockSize</a> :: <a href="Crypto-Classes.html#t:BlockCipher">BlockCipher</a> k =&gt; k -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:putPaddedPKCS5">putPaddedPKCS5</a> :: <a href="Crypto-Types.html#t:ByteLength">ByteLength</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a></li><li class="src short"><a href="#v:unpadPKCS5safe">unpadPKCS5safe</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:unpadPKCS5">unpadPKCS5</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:padESP">padESP</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:unpadESP">unpadESP</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:padESPBlockSize">padESPBlockSize</a> :: <a href="Crypto-Classes.html#t:BlockCipher">BlockCipher</a> k =&gt; k -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:putPadESPBlockSize">putPadESPBlockSize</a> :: <a href="Crypto-Classes.html#t:BlockCipher">BlockCipher</a> k =&gt; k -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a></li><li class="src short"><a href="#v:putPadESP">putPadESP</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a></li></ul></div><div id="interface"><h1 id="g:1">PKCS5 (RFC 1423) based [un]padding routines</h1><div class="top"><p class="src"><a name="v:padPKCS5" class="def">padPKCS5</a> :: <a href="Crypto-Types.html#t:ByteLength">ByteLength</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Padding.html#padPKCS5" class="link">Source</a></p><div class="doc"><p>PKCS5 (aka RFC1423) padding method.
 This method will not work properly for pad modulos &gt; 256</p></div></div><div class="top"><p class="src"><a name="v:padBlockSize" class="def">padBlockSize</a> :: <a href="Crypto-Classes.html#t:BlockCipher">BlockCipher</a> k =&gt; k -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Padding.html#padBlockSize" class="link">Source</a></p><div class="doc"><p>PKCS5 (aka RFC1423) padding method using the BlockCipher instance
 to determine the pad size.</p></div></div><div class="top"><p class="src"><a name="v:putPaddedPKCS5" class="def">putPaddedPKCS5</a> :: <a href="Crypto-Types.html#t:ByteLength">ByteLength</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a> <a href="src/Crypto-Padding.html#putPaddedPKCS5" class="link">Source</a></p><div class="doc"><p>Ex:</p><pre>    putPaddedPKCS5 m bs
</pre><p>Will pad out <code>bs</code> to a byte multiple
 of <code>m</code> and put both the bytestring and it's padding via <code><a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a></code>
 (this saves on copying if you are already using Cereal).</p></div></div><div class="top"><p class="src"><a name="v:unpadPKCS5safe" class="def">unpadPKCS5safe</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Padding.html#unpadPKCS5safe" class="link">Source</a></p><div class="doc"><p>unpad a strict bytestring padded in the typical PKCS5 manner.
 This routine verifies all pad bytes and pad length match correctly.</p></div></div><div class="top"><p class="src"><a name="v:unpadPKCS5" class="def">unpadPKCS5</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Padding.html#unpadPKCS5" class="link">Source</a></p><div class="doc"><p>unpad a strict bytestring without checking the pad bytes and
 length any more than necessary.</p></div></div><h1 id="g:2">ESP (RFC 4303) [un]padding routines</h1><div class="top"><p class="src"><a name="v:padESP" class="def">padESP</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Padding.html#padESP" class="link">Source</a></p><div class="doc"><p>Pad a bytestring to the IPSEC esp specification</p><pre>padESP m payload</pre><p>is equivilent to:</p><pre>              (msg)       (padding)       (length field)
    B.concat [payload, B.pack [1,2,3,4..], B.pack [padLen]]
</pre><p>Where:</p><ul><li>the msg is any payload, including TFC.</li><li>the padding is &lt;= 255</li><li>the length field is one byte.</li></ul><p>Notice the result bytesting length remainder <code>r</code> equals zero.  The lack
  of a &quot;next header&quot; field means this function is not directly useable for
  an IPSec implementation (copy/paste the 4 line function and add in a
  &quot;next header&quot; field if you are making IPSec ESP).</p></div></div><div class="top"><p class="src"><a name="v:unpadESP" class="def">unpadESP</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Padding.html#unpadESP" class="link">Source</a></p><div class="doc"><p>unpad and return the padded message (<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> is returned if the padding is invalid)</p></div></div><div class="top"><p class="src"><a name="v:padESPBlockSize" class="def">padESPBlockSize</a> :: <a href="Crypto-Classes.html#t:BlockCipher">BlockCipher</a> k =&gt; k -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> <a href="src/Crypto-Padding.html#padESPBlockSize" class="link">Source</a></p><div class="doc"><p>Like padESP but use the BlockCipher instance to determine padding size</p></div></div><div class="top"><p class="src"><a name="v:putPadESPBlockSize" class="def">putPadESPBlockSize</a> :: <a href="Crypto-Classes.html#t:BlockCipher">BlockCipher</a> k =&gt; k -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a> <a href="src/Crypto-Padding.html#putPadESPBlockSize" class="link">Source</a></p><div class="doc"><p>Like putPadESP but using the BlockCipher instance to determine padding size</p></div></div><div class="top"><p class="src"><a name="v:putPadESP" class="def">putPadESP</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a> <a href="src/Crypto-Padding.html#putPadESP" class="link">Source</a></p><div class="doc"><p>Pad a bytestring to the IPSEC ESP specification using <code><a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a></code>.
 This can reduce copying if you are already using <code><a href="file:///usr/share/doc/libghc-cereal-doc/html/Data-Serialize-Put.html#t:Put">Put</a></code>.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>