⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 specifications.html

📁 java非对称加密的源代码
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html><head><title>Bouncy Castle Crypto Package</title></head><body bgcolor="#ffffff" text="#000000#"><center><h1>Bouncy Castle Crypto Package</h1><font size=1><pre></pre></font></center><h2>1.0 Introduction</h2>The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms.  The package is organised so that it contains a light-weight API suitable for use in any environment(including the newly released J2ME) with the additional infrastructureto conform the algorithms to the JCE framework.<p>Except where otherwise stated, this software is distributed under a licensebased on the MIT X Consortium license.  To view the license, see <a href="./LICENSE.html">here</a>.The OpenPGP library also includes a modified BZIP2 library whichis licensed under the <a href="http://www.apache.org/licenses/">Apache Software License, Version 1.1</a>.<p>If you have the full package you will have six jar files, bcprov*.jarwhich contains the BC provider, jce-*.jar which containsthe JCE provider, clean room API, and bcmail*.jar which contains themail API.<p>Note: if you are using JDK 1.0, you will just find a class hierarchy inthe classes directory.<p>To view examples, look at the test programs in the packages:<ul>	<li><b>org.bouncycastle.crypto.test</b>	<li><b>org.bouncycastle.jce.provider.test</b></ul><p>To verify the packages, run the following Java programs with theappropriate classpath:<ul>	<li><b>java org.bouncycastle.crypto.test.RegressionTest</b>	<li><b>java org.bouncycastle.jce.provider.test.RegressionTest</b></ul><h2>2.0 Patents</h2><p>Some of the algorithms in the Bouncy Castle APIs are patented in someplaces. It is upon the user of the library to be aware of what thelegal situation is in their own situation, however we have been askedto specifically mention the patent below at the request of the patentholder.<p>The IDEA encryption algorithm is patented in the USA, Japan, and Europeincluding at least Austria, France, Germany, Italy, Netherlands, Spain, Sweden,Switzerland and the United Kingdom. Non-commercial use is free, howeverany commercial products that make use of IDEA are liable for royalties.Please see<a href="http://www.mediacrypt.com">www.mediacrypt.com</a> forfurther details.<h2>3.0 Specifications</h2><ul><li> clean room implementation of the JCE API <li> light-weight cryptographic API consisting of support for	<ul>		<li>BlockCipher		<li>BufferedBlockCipher		<li>AsymmetricBlockCipher		<li>BufferedAsymmetricBlockCipher		<li>StreamCipher		<li>BufferedStreamCipher        <li>KeyAgreement        <li>IESCipher		<li>Digest		<li>Mac		<li>PBE		<li>Signers	</ul><li> JCE compatible framework for a Bouncy Castle provider</ul><h2>4.0 Light-weight API</h2><p>This API has been specifically developed for those circumstanceswhere the rich API and integration requirements of the JCE arenot required.  <p>However as a result, the light-weight API requires more effortand understanding on the part of a developer to initialise and utilise the algorithms.<h3>4.1 Example</h3><p>To utilise the light-weight API in a program, the fundamentalsare as follows;<pre><code>	/*	 * This will use a supplied key, and encrypt the data	 * This is the equivalent of DES/CBC/PKCS5Padding	 */	BlockCipher engine = new DESEngine();	BufferedBlockCipher cipher = new PaddedBlockCipher(new CBCCipher(engine));	byte[] key = keyString.getBytes();	byte[] input = inputString.getBytes();	cipher.init(true, new KeyParameter(key));	byte[] cipherText = new byte[cipher.getOutputSize(input.length)];		int outputLen = cipher.processBytes(input, 0, input.length, cipherText, 0);	try	{		cipher.doFinal(cipherText, outputLen);	}	catch (CryptoException ce)	{		System.err.println(ce);		System.exit(1);	}</code></pre><h3>4.2 Algorithms</h3><p>The light-weight API has built in support for the following:<h4>Symmetric (Block)</h4><p>The base interface is <b>BlockCipher</b> and has the followingimplementations which match the modes the block cipher canbe operated in.<p><table cellpadding=5 cellspacing=0 border=1 width=80%><tr><th>Name</th><th>Constructor</th><th>Notes</th></tr><tr><td><b>BufferedBlockCipher</b></td><td>BlockCipher</td><td>&nbsp;</td></tr><tr><td><b>CBCBlockCipher</b></td><td>BlockCipher</td><td>&nbsp;</td></tr><tr><td><b>CFBBlockCipher</b></td><td>BlockCipher, block size (in bits)</td><td>&nbsp;</td></tr><tr><td><b>CCMBlockCipher</b></td><td>BlockCipher</td><td>Packet mode - requires all data up front.</td></tr><tr><td><b>EAXBlockCipher</b></td><td>BlockCipher</td><td>&nbsp;</td></tr><tr><td><b>OFBBlockCipher</b></td><td>BlockCipher, block size (in bits)</td><td>&nbsp;</td></tr><tr><td><b>SICBlockCipher</b></td><td>BlockCipher, block size (in bits)</td><td>Also known as CTR mode</td></tr><tr><td><b>OpenPGPCFBBlockCipher</b></td><td>BlockCipher</td><td>&nbsp;</td></tr><tr><td><b>GOFBBlockCipher</b></td><td>BlockCipher</td><td>GOST OFB mode</td></tr></table><p><b>BufferedBlockCipher</b> has a further sub-classes<p><table cellpadding=5 cellspacing=0 border=1 width=80%><tr><th>Name</th><th>Constructor</th><th>Notes</th></tr><tr><td><b>PaddedBufferedBlockCipher</b></td><td>BlockCipher</td><td>a buffered block cipher that can use padding - default PKCS5/7 padding</td></tr><tr><td><b>CTSBlockCipher</b></td><td>BlockCipher</td><td>Cipher Text Stealing</td></tr></table><p>The following paddings can be used with the PaddedBufferedBlockCipher.<p><table cellpadding=5 cellspacing=0 border=1 width=80%><tr><th>Name</th><th>Description</th></tr><tr><td>PKCS7Padding</td><td>PKCS7/PKCS5 padding</td></tr><tr><td>ISO10126d2Padding</td><td>ISO 10126-2 padding</td></tr><tr><td>X932Padding</td><td>X9.23 padding</td></tr><tr><td>ISO7816d4Padding</td><td>ISO 7816-4 padding (ISO 9797-1 scheme 2)</td></tr><tr><td>ZeroBytePadding</td><td>Pad with Zeros (not recommended)</td></tr></table><p>The following cipher engines are implemented that can beused with the above modes.<p><table cellpadding=5 cellspacing=0 border=1 width=80%><tr><th>Name</th><th>KeySizes (in bits) </th><th>Block Size</th><th>Notes</th></tr><tr><td><b>AESEngine</b></td><td>0 .. 256 </td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>AESWrapEngine</b></td><td>0 .. 256 </td><td>128 bit</td><td>Implements FIPS AES key wrapping</td></tr><tr><td><b>BlowfishEngine</b></td><td>0 .. 448 </b></td><td>64 bit</td><td>&nbsp;</td></tr><tr><td><b>CamelliaEngine</b></td><td>128, 192, 256</td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>CamelliaWrapEngine</b></td><td>128, 192, 256</td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>CAST5Engine</b></td><td>0 .. 128 </b></td><td>64 bit</td><td>&nbsp;</td></tr><tr><td><b>CAST6Engine</b></td><td>0 .. 256 </b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>DESEngine</b></td><td>64</td><td>64 bit</td><td>&nbsp;</td></tr><tr><td><b>DESedeEngine</b></td><td>128, 192</td><td>64 bit</td><td>&nbsp;</td></tr><tr><td><b>DESedeWrapEngine</b></td><td>128, 192</td><td>64 bit</td><td>Implements Draft IETF DESede key wrapping</td></tr><tr><td><b>GOST28147Engine</b></td><td>256</td><td>64 bit</td><td>Has a range of S-boxes</td></tr><tr><td><b>IDEAEngine</b></td><td>128</td><td>64 bit</td><td>&nbsp;</td></tr><tr><td><b>NoekeonEngine</b></td><td>128</td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>RC2Engine</b></td><td>0 .. 1024 </td><td>64 bit</td><td>&nbsp;</td></tr><tr><td><b>RC532Engine</b></td><td>0 .. 128 </td><td>64 bit</td><td>Uses a 32 bit word</td></tr><tr><td><b>RC564Engine</b></td><td>0 .. 128 </td><td>128 bit</td><td>Uses a 64 bit word</td></tr><tr><td><b>RC6Engine</b></td><td>0 .. 256 </td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>RijndaelEngine</b></td><td>0 .. 256 </td><td>128 bit, 160 bit, 192 bit, 224 bit, 256 bit</td><td>&nbsp;</td></tr><tr><td><b>SEEDEngine</b></td><td>128</td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>SEEDWrapEngine</b></td><td>128</td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>SerpentEngine</b></td><td>128, 192, 256 </td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>SkipjackEngine</b></td><td>0 .. 128 </td><td>64 bit</td><td>&nbsp;</td></tr><tr><td><b>TEAEngine</b></td><td>128</td><td>64 bit</td><td>&nbsp;</td></tr><tr><td><b>TwofishEngine</b></td><td>128, 192, 256 </td><td>128 bit</td><td>&nbsp;</td></tr><tr><td><b>XTEAEngine</b></td><td>128</td><td>64 bit</td><td>&nbsp;</td></tr></table><h4>Symmetric (Stream)</h4><p>The base interface is <b>StreamCipher</b> and has the followingimplementations which match the modes the stream cipher canbe operated in.<p><table cellpadding=5 cellspacing=0 border=1 width=80%><tr><th>Name</th><th>Constructor</th><th>Notes</th></tr><tr><td><b>BlockStreamCipher</b></td><td>BlockCipher</td><td>&nbsp;</td></tr></table><p>The following cipher engines are implemented that can beused with the above modes.<p><table cellpadding=5 cellspacing=0 border=1 width=80%><tr><th>Name</th><th>KeySizes (in bits) </th><th>Notes</th></tr><tr><td><b>RC4Engine</b></td><td>40 .. 2048</td><td>&nbsp;</td></tr><tr><td><b>HC128Engine</b></td><td>128</td><td>&nbsp;</td></tr><tr><td><b>HC256Engine</b></td><td>256</td><td>&nbsp;</td></tr><tr><td><b>Salsa20Engine</b></td><td>128/256</td><td>&nbsp;</td></tr><tr><td><b>ISAACEngine</b></td><td>32 .. 8192</td><td>&nbsp;</td></tr><tr><td><b>VMPCEngine</b></td><td>8 .. 6144</td><td>&nbsp;</td></tr></table><h4>Block Asymmetric</h4><p>The base interface is <b>AsymmetricBlockCipher</b> and has the followingimplementations which match the modes the cipher can be operated in.<p><table cellpadding=5 cellspacing=0 border=1 width=80%><tr><th>Name</th><th>Constructor</th><th>Notes</th></tr><tr><td><b>BufferedAsymmetricBlockCipher</b></td><td>AsymmetricBlockCipher</td><td>&nbsp;</td></tr><tr><td><b>OAEPEncoding</b></td><td>AsymmetricBlockCipher</td><td>&nbsp;</td></tr><tr><td><b>PKCS1Encoding</b></td><td>AsymmetricBlockCipher</td><td>&nbsp;</td></tr><tr><td><b>ISO9796d1Encoding</b></td><td>AsymmetricBlockCipher</td><td>ISO9796-1</td></tr></table><p>The following cipher engines are implemented that can beused with the above modes.<p><table cellpadding=5 cellspacing=0 border=1 width=80%><tr><th>Name</th><th>KeySizes (in bits)</th><th>Notes</th></tr><tr><td><b>RSAEngine</b></td><td>any multiple of 8 large enough for the encoding.</td><td>&nbsp;</td></tr><tr><td><b>ElGamalEngine</b></td><td>any multiple of 8 large enough for the encoding.</td><td>&nbsp;</td></tr></table><h4>Digest</h4><p>The base interface is <b>Digest</b> and has the followingimplementations <p><table cellpadding=5 cellspacing=0 border=1 width=80%><tr><th>Name</th><th>Output (in bits)</th><th>Notes</th></tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -