【发布时间】:2014-08-09 08:34:21
【问题描述】:
我正在为 2048 位 RSA 实现一个 java 卡小程序。我想知道如何使用 65537 以外的公共指数 (e) 创建 RSA 密钥对。
卡生成 RSA 密钥对,并返回其公共指数 (e) 和模数 (n)。但是公共指数每次都是 65537(十六进制的 0x10001)。我的代码如下
// Initialize objects for RSA Keys and Pair
objRSAPriKey = (RSAPrivateCrtKey)KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_CRT_PRIVATE, KeyBuilder.LENGTH_RSA_2048, false);
objRSAPubKey = (RSAPublicKey)KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, KeyBuilder.LENGTH_RSA_2048, false);
objRSAKeyPair= new KeyPair(KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_RSA_2048);
...
// Generate Key Pairs
objRSAKeyPair.genKeyPair();
objRSAPriKey = (RSAPrivateCrtKey)objRSAKeyPair.getPrivate();
objRSAPubKey = (RSAPublicKey)objRSAKeyPair.getPublic();
GetResLen = objRSAPubKey.getModulus(Rb_GetRes, BAS);
GetResLen += objRSAPubKey.getExponent(Rb_GetRes, GetResLen);
当然我知道这些key是不一样的,因为每次小程序生成key时key(n,d,p,q)的其他值都不一样。但我想知道如何生成具有 2048 位大小的公共指数的 RSA 密钥对
谢谢。
【问题讨论】: