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

📄 specifications.html

📁 java非对称加密的源代码
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<tr><td><b>MD2Digest</b></td><td>128</td><td>&nbsp;</td></tr><tr><td><b>MD4Digest</b></td><td>128</td><td>&nbsp;</td></tr><tr><td><b>MD5Digest</b></td><td>128</td><td>&nbsp;</td></tr><tr><td><b>RipeMD128Digest</b></td><td>128</td><td>basic RipeMD</td></tr><tr><td><b>RipeMD160Digest</b></td><td>160</td><td>enhanced version of RipeMD</td></tr><tr><td><b>RipeMD256Digest</b></td><td>256</td><td>expanded version of RipeMD128</td></tr><tr><td><b>RipeMD320Digest</b></td><td>320</td><td>expanded version of RipeMD160</td></tr><tr><td><b>SHA1Digest</b></td><td>160</td><td>&nbsp;</td></tr><tr><td><b>SHA224Digest</b></td><td>224</td><td>FIPS 180-2</td></tr><tr><td><b>SHA256Digest</b></td><td>256</td><td>FIPS 180-2</td></tr><tr><td><b>SHA384Digest</b></td><td>384</td><td>FIPS 180-2</td></tr><tr><td><b>SHA512Digest</b></td><td>512</td><td>FIPS 180-2</td></tr><tr><td><b>TigerDigest</b></td><td>192</td><td>The Tiger Digest.</td></tr><tr><td><b>GOST3411Digest</b></td><td>256</td><td>The GOST-3411 Digest.</td></tr><tr><td><b>WhirlpoolDigest</b></td><td>512</td><td>The Whirlpool Digest.</td></tr></table><h4>MAC</h4><p>The base interface is <b>Mac</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><tr><td><b>CBCBlockCipherMac</b></td><td>blocksize/2 unless specified</td><td>&nbsp;</td></tr><tr><td><b>CFBBlockCipherMac</b></td><td>blocksize/2, in CFB 8 mode, unless specified</td><td>&nbsp;</td></tr><tr><td><b>HMac</b></td><td>digest length</td><td>&nbsp;</td></tr></table><h4>PBE</h4><p>The base class is <b>PBEParametersGenerator</b> and has the followingsub-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>PKCS5S1ParametersGenerator</b></td><td>Digest</td><td>&nbsp;</td></tr><tr><td><b>PKCS5S2ParametersGenerator</b></td><td>&nbsp;</td><td>Uses SHA1/Hmac as defined</td></tr><tr><td><b>PKCS12ParametersGenerator</b></td><td>Digest</td><td>&nbsp;</td></tr><tr><td><b>OpenSSLPBEParametersGenerator</b></td><td>&nbsp;</td><td>Uses MD5 as defined</td></tr></table><h4>Key Agreement</h4><p>Two versions of Diffie-Hellman key agreement are supported, the basicversion, and one for use with long term public keys. Two versions ofkey agreement using Elliptic Curve cryptography are also supported,standard Diffie-Hellman key agreement and standard key agreement withco-factors.<p>The agreement APIs are in the <b>org.bouncycastle.crypto.agreement</b> package.Classes for generating Diffie-Hellman parameters can be found in the<b>org.bouncycastle.crypto.params</b> and <b>org.bouncycastle.crypto.generators</b> packages.<p><h4>IESCipher</h4><p>The IES cipher is based on the one described in IEEE P1363a (draft 10), foruse with either traditional Diffie-Hellman or Elliptic Curve Diffie-Hellman.<p><b>Note:</b> At the moment this is still a draft, don't use it for anythingthat may be subject to long term storage, the key values produced may wellchange as the draft is finalised.<p><h4>Signers</h4><p>DSA, ECDSA, ISO-9796-2, GOST-3410-94, GOST-3410-2001, and RSA-PSS are supported by the <b>org.bouncycastle.crypto.signers</b>package. Note: as these are light weight classes, if you need to use SHA1 or GOST-3411(as defined in the relevant standards) you'll also need to make use of the appropriatedigest class in conjunction with these.Classes for generating DSA and ECDSA parameters can be found in the<b>org.bouncycastle.crypto.params</b> and <b>org.bouncycastle.crypto.generators</b> packages.<p><h3>4.3 ASN.1 package</h3><p>The light-weight API has direct interfaces into a package capable ofreading and writing DER-encoded ASN.1 objects and for the generationof X.509 V3 certificate objects and PKCS12 files. BER InputStream andOutputStream classes are provided as well.<h2>5.0 Bouncy Castle Provider</h2><p>The Bouncy Castle provider is a JCE compliant provider thatis a wrapper built on top of the light-weight API.<p>The advantage for writing application code that uses the provider interface to cryptographic algorithms is that theactual provider used can be selected at run time.  This is extremely valuable for applications that may wish to make use of a provider that has underlying hardware forcryptographic computation, or where an application may havebeen developed in an environment with cryptographic exportcontrols.<h3>5.1 Example</h3><p>To utilise the JCE provider in a program, the fundamentalsare as follows;<pre><code>	/*	 * This will generate a random key, and encrypt the data	 */	Key		key;	KeyGenerator	keyGen;	Cipher		encrypt;	Security.addProvider(new BouncyCastleProvider());	try	{		// "BC" is the name of the BouncyCastle provider		keyGen = KeyGenerator.getInstance("DES", "BC");		keyGen.init(new SecureRandom());		key = keyGen.generateKey();		encrypt = Cipher.getInstance("DES/CBC/PKCS5Padding", "BC");	}	catch (Exception e)	{		System.err.println(e);		System.exit(1);	}	encrypt.init(Cipher.ENCRYPT_MODE, key);	bOut = new ByteArrayOutputStream();	cOut = new CipherOutputStream(bOut, encrypt);	cOut.write("plaintext".getBytes());	cOut.close();	// bOut now contains the cipher text</code></pre><p>The provider can also be configured as part of your environment via static registrationby adding an entry to the java.security properties file (found in $JAVA_HOME/jre/lib/security/java.security, where $JAVA_HOME is the location of your JDK/JRE distribution). You'll find detailed instructions in the file but basically it comes down to adding a line:<pre><code>    security.provider.&lt;n&gt;=org.bouncycastle.jce.provider.BouncyCastleProvider</code></pre><p>Where &lt;n&gt; is the preference you want the provider at (1 being the most prefered).<p>Where you put the jar is up to mostly up to you, although with jdk1.3 andjdk1.4 the best (and in some cases only) place to have it is in $JAVA_HOME/jre/lib/ext. Note: under Windows there will normally be a JRE and a JDK install of Java if you think you have installed it correctly and it still doesn't work chances are you have added the provider to the installation not being used.<p><b>Note</b>: with JDK 1.4 and later you will need to have installed the unrestricted policyfiles to take full advantage of the provider. If you do not install the policy files you are likelyto get something like the following:<b><pre>        java.lang.SecurityException: Unsupported keysize or algorithm parameters                at javax.crypto.Cipher.init(DashoA6275)</pre></b>The policy files can be found at the same place you downloaded the JDK.<p><h3>5.2 Algorithms</h3><h4>Symmetric (Block)</h4><p>Modes:<ul><li>ECB<li>CBC<li>OFB(n)<li>CFB(n)<li>SIC (also known as CTR)<li>OpenPGPCFB<li>CTS (equivalent to CBC/WithCTS)<li>GOFB<li>CCM<li>EAX</ul><p>Where <i>(n)</i> is a multiple of 8 that gives the blocksize in bits,eg, OFB8. Note that OFB and CFB mode can be used with plain text thatis not an exact multiple of the block size if NoPadding has been specified.<p>Padding Schemes:<ul><li>No padding<li>PKCS5/7<li>ISO10126/ISO10126-2<li>ISO7816-4/ISO9797-1<li>X9.23/X923<li>TBC<li>ZeroByte<li>withCTS (if used with ECB mode)</ul><p>When placed together this gives a specification for an algorithmas;<ul><li>DES/CBC/X9.23Padding<li>DES/OFB8/NoPadding<li>IDEA/CBC/ISO10126Padding<li>IDEA/CBC/ISO7816-4Padding<li>SKIPJACK/ECB/PKCS7Padding<li>DES/ECB/WithCTS</ul><p>Note: default key sizes are in bold.<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>AES</td><td>0 .. 256 <b>(192)</b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>AESWrap</td><td>0 .. 256 <b>(192)</b></td><td>128 bit</td><td>A FIPS AES key wrapper</td></tr><tr><td>Blowfish</td><td>0 .. 448 <b>(448)</b></td><td>64 bit</td><td>&nbsp;</td></tr><tr><td>Camellia</td><td>128, 192, 256</td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>CamelliaWrap</td><td>128, 192, 256</td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>CAST5</td><td>0 .. 128<b>(128)</b></td><td>64 bit</td><td>&nbsp;</td></tr><tr><td>CAST6</td><td>0 .. 256<b>(256)</b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>DES</td><td>64</td><td>64 bit</td><td>&nbsp;</td></tr><tr><td>DESede</td><td>128, 192</td><td>64 bit</td><td>&nbsp;</td></tr><tr><td>DESedeWrap</td><td>128, 192</td><td>128 bit</td><td>A Draft IETF DESede key wrapper</td></tr><tr><td>GOST28147</td><td>256</td><td>64 bit</td><td>&nbsp;</td></tr><tr><td>IDEA</td><td>128 <b>(128)</b></td><td>64 bit</td><td>&nbsp;</td></tr><tr><td>Noekeon</td><td>128<b>(128)</b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>RC2</td><td>0 .. 1024 <b>(128)</b></td><td>64 bit</td><td>&nbsp;</td></tr><tr><td>RC5</td><td>0 .. 128 <b>(128)</b></td><td>64 bit</td><td>Uses a 32 bit word</td></tr><tr><td>RC5-64</td><td>0 .. 256 <b>(256)</b></td><td>128 bit</td><td>Uses a 64 bit word</td></tr><tr><td>RC6</td><td>0 .. 256 <b>(128)</b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>Rijndael</td><td>0 .. 256 <b>(192)</b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>SEED</td><td>128<b>(128)</b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>SEEDWrap</td><td>128<b>(128)</b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>Serpent</td><td>128, 192, 256 <b>(256)</b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>Skipjack</td><td>0 .. 128 <b>(128)</b></td><td>64 bit</td><td>&nbsp;</td></tr><tr><td>TEA</td><td>128 <b>(128)</b></td><td>64 bit</td><td>&nbsp;</td></tr><tr><td>Twofish</td><td>128, 192, 256 <b>(256)</b></td><td>128 bit</td><td>&nbsp;</td></tr><tr><td>XTEA</td><td>128 <b>(128)</b></td><td>64 bit</td><td>&nbsp;</td></tr></table><h4>Symmetric (Stream)</h4><p>Note: default key sizes are in bold.<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>RC4</td><td>40 .. 2048 bits <b>(128)</b></td><td>&nbsp;</td></tr><tr><td>HC128</td><td>(128)</td><td>&nbsp;</td></tr><tr><td>HC256</td><td>(256)</td><td>&nbsp;</td></tr><tr><td>Salsa20</td><td>128/256<b>(128)</b></td><td>&nbsp;</td></tr><tr><td>VMPC</td><td>128/6144<b>(128)</b></td><td>&nbsp;</td></tr></table><h4>Block Asymmetric</h4><p>Encoding:<ul><li>OAEP - Optimal Asymmetric Encryption Padding<li>PCKS1 - PKCS v1.5 Padding<li>ISO9796-1 - ISO9796-1 edition 1 Padding</ul>

⌨️ 快捷键说明

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