Welcome![Sign In][Sign Up]
Location:
Search - RSA keypair

Search list

[Crack HackGenerateKeyPair

Description: use bouncycastle to generate RSA keyPair
Platform: | Size: 1024 | Author: borispeng | Hits:

[OS programsrc

Description: 实习三 基于RSA的公钥加密 一、实习目的 1、 理解公钥密码算法,熟悉常有的密码算法:RSA、椭圆曲线密码体制 2、 以RSA加密算法为例,掌握公钥密码算法加解密过程的实现。 二、实习内容 以RSA为例,利用java中的相关类实现对指定字符串的加解密。 1、 生成公钥密钥对 (1)利用java中的KeypairGenerator类创建公钥密钥对,利用KeypairGenerator的静态方法getInstance()获得KeypairGenerator类型的对象,所需参数为加密算法的名称RSA。 KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA") (2)利用KeyPairGenerator类的genKeyPair()方法返回生成的密钥对: KeyPair kp = kpg.genKeyPair() (3)返回此密钥对的公钥组件的引用和私钥组件的引用 PublicKey pbkey = kp.getPublic() PrivateKey prkey = kp.getPrivate() (4)将生成的公钥写入文件Skey_RSA_pub.dat FileOutputStream f1 = new FileOutputStream("Skey_RSA_pub.dat") ObjectOutputStream b1 = new ObjectOutputStream(f1) b1.writeObject(pbkey) 用同样的方法将私钥写入文件Skey_RSA_pri.dat -Internship RSA public key encryption based on three An internship purpose An understanding of public key cryptography algorithm, familiar with common cryptographic algorithms: RSA, elliptic curve cryptography 2, RSA encryption algorithm, for example, public key cryptography algorithm to achieve master encryption and decryption process. Second, the practical content In RSA, for example, the use of java in the relevant class implements the specified string encryption and decryption. 1, generates a public key pair (1) the use of java class in KeypairGenerator create a public key pair using KeypairGenerator static method getInstance () to get the object KeypairGenerator type parameters required for the encryption algorithm name RSA. KeyPairGenerator kpg = KeyPairGenerator.getInstance ("RSA") (2) the use of genKeyPair KeyPairGenerator class () method returns the generated key pair: KeyPair kp = kpg.genKeyPair () References (3) Returns the public key component of this key an
Platform: | Size: 2048 | Author: 杨平 | Hits:

CodeBus www.codebus.net