没有合适的资源?快使用搜索试试~ 我知道了~
Java的椭圆曲线加密ecc算法
3星 · 超过75%的资源 需积分: 47 144 下载量 39 浏览量
2011-03-09
16:50:56
上传
评论 1
收藏 76KB DOC 举报
温馨提示
试读
15页
椭圆曲线加密算法 java语言实现 elliptic curve private keys produce DER encodings of PKCS8 PrivateKeyInfo objects and elliptic curve public keys produce DER encodings of X.509 SubjectPublicKeyInfo objects.
资源推荐
资源详情
资源评论
Java 的 ecc 算法
Elliptic Curve 的密钥对产生和密钥工厂
介绍
Key pair generation in elliptic curve follows the same principles as the other algorithms, the m
ain difference being that, unlike algorithms such as RSA, elliptic curve keys exist only in the c
ontext of a particular elliptic curve and require to have curve parameters associated with them
to be of any use.
!"
#$%
!&'(
) * +
,,-
在椭圆形的曲线的密钥对的产生跟随与其他算法相同的原则, 主要的差是那, 不像算法,像是 R
SA ,椭圆形的曲线键只在一个特别的椭圆形的曲线的语境存在而且需要和他们联合曲线叁数
为任何使用。
有说, 有一个反常事物在有被提供者支持的二个 API 中有椭圆形的曲线超过其他的算法为使用
他们。 这的理由是 JDK 椭圆形的曲线支持只与 JDK 1.5 的释放一起介绍。 在支持椭圆形的曲
线提供者必须包括一些提供者特定的 classes 让它被用, 而且当做快活的城堡自从释放 1.04
以后就已经支持椭圆形的 cuve ,它必须提供它是自己的 API之前。
搜索单词:Elliptic Curve java source
访问路径:http://www.bouncycastle.org/wiki/display/JA1/Using+Elliptic+Curve
除了差之外,在叁数中,椭圆形曲线键的代是 Fp 和 F2 m 的 identitical 。
......................以下是手工翻译
椭圆曲线算法密钥对的产生和其他的算法一样,主要差别是不像其他的算法如 /0 算法,椭
圆曲线算法密钥仅仅依赖于椭圆曲线参数
----------------------------------------以下是页面拷贝
Java APIs 1.X Log In View a printable version of the current page.
Elliptic Curve Key Pair Generation and Key Factories
[Browse Space] Browse Space
* View
* Info
Added by David Hook, last edited by David Hook on Oct 27, 2006 (view change)
Labels:
(None)
Add Labels
Wait Image
Enter labels to add to this page:
Tip: Looking for a label? Just start typing.
Introduction
Key pair generation in elliptic curve follows the same principles as the other algorithms, the main difference being
that, unlike algorithms such as RSA, elliptic curve keys exist only in the context of a particular elliptic curve and
require to have curve parameters associated with them to be of any use.
Having said that, there is one anomaly with elliptic curve over other algorithms in that there are two APIs supported
by the provider for using them. The reason for this is that JDK elliptic curve support was only introduced with the
release of JDK 1.5. Prior to that providers supporting elliptic curve had to include some provider specific classes to
allow it to be used, and as Bouncy Castle has supported elliptic cuve since release 1.04 it had to provide it's own API.
Other than differences in parameters the generation of elliptic curve keys is identitical for both Fp and F2m.
Using ASN.1 Encoding
Like other asymmetric algorithms, elliptic curve private keys produce DER encodings of PKCS8 PrivateKeyInfo
objects and elliptic curve public keys produce DER encodings of X.509 SubjectPublicKeyInfo objects.
The following example shows a simple case of copying a key pair using the getEncoded() method on the public and
private keys and the X509EncodedKeySpec and PKCS8EncodedKeySpec classes.
import java.security.KeyFactory;
import java.security.spec.X509EncodedKeySpec;
import java.security.spec.PKCS8EncodedKeySpec;
...
构造方法摘要
KeyPair1 2 2 3
2222222222根据给定的公钥和私钥构造密钥对。
KeyPair pair = ...;
// getInstance1String2Provider23
KeyFactory fact = KeyFactory.getInstance("ECDSA", "BC");
generatePublic 根据提供的密钥规范(密钥材料)生成公钥对象。
PublicKey public = fact.generatePublic(new X509EncodedKeySpec(pair.getPublic().getEncoded()));
PrivateKey private = fact.generatePrivate(new X509EncodedKeySpec(pair.getPrivate().getEncoded()));
Using the Bouncy Castle Specific APIs
The Bouncy Castle API for elliptic curve consists of a collection of interfaces and classes defined in
org.bouncycastle.jce, org.bouncycastle.jce.interfaces, and org.bouncycastle.jce.spec packages which provide provider
specific support for elliptic curve keys, parameters, and named curve handling.
Key Pair Generation
Key pair generation can be done using explicitly created parameters or by retrieving a named curve from a lookup
table.
From Explicit Parameters
An org.bouncycastle.jce.ECParameterSpec is required to construct an elliptic curve key. The long way of creating
one of these is to create the ECParameterSpec object from a Bouncy Castle ECCurve object and an associated base
point and order.
Normally you'd only do this if the curve you want is not already present in one of the named curve tables (see
below), but if you had a set of parameters you wanted to use it would look something like this:
import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.jce.spec.ECParameterSpec;
...
ECCurve curve = new ECCurve.Fp(
new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"),
// q
new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16), // a
new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16)); // b
ECParameterSpec ecSpec = new ECParameterSpec(
curve,
curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")),
// G
new
BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n
KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC");
g.initialize(ecSpec, new SecureRandom());
KeyPair pair = g.generateKeyPair();
As you can see it is a two step process. First you need to create the curve and then you need to associate the curve
with a base point and an order using an ECParameterSpec which is then used to initialise the KeyPairGenerator
剩余14页未读,继续阅读
guyueyanziliqiang
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页