没有合适的资源?快使用搜索试试~ 我知道了~
首页Java的椭圆曲线加密ecc算法
Java的椭圆曲线加密ecc算法
3星 · 超过75%的资源 需积分: 47 144 下载量 110 浏览量
更新于2023-03-03
评论 1
收藏 76KB DOC 举报
椭圆曲线加密算法 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币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- ExcelVBA中的Range和Cells用法说明.pdf
- 基于单片机的电梯控制模型设计.doc
- 主成分分析和因子分析.pptx
- 共享笔记服务系统论文.doc
- 基于数据治理体系的数据中台实践分享.pptx
- 变压器的铭牌和额定值.pptx
- 计算机网络课程设计报告--用winsock设计Ping应用程序.doc
- 高电压技术课件:第03章 液体和固体介质的电气特性.pdf
- Oracle商务智能精华介绍.pptx
- 基于单片机的输液滴速控制系统设计文档.doc
- dw考试题 5套.pdf
- 学生档案管理系统详细设计说明书.doc
- 操作系统PPT课件.pptx
- 智慧路边停车管理系统方案.pptx
- 【企业内控系列】企业内部控制之人力资源管理控制(17页).doc
- 温度传感器分类与特点.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论10