简体   繁体   中英

Encrypting network traffic with Java and RSA

I'm wondering how I should approach a homework assignment.

I must develop a simple server and client in Java, which I have done. Next, I must encrypt the traffic between this server and client by using RSA with the following given keys.

Client Public Key: (5, 10142789312725007)
Client Private Key: (8114231289041741, 10142789312725007)
Server Public Key: (5, 10142701089716483)
Server Private Key: (6085620532976717, 10142701089716483)

Does Java have built-in functionality that will allow me to do this easily?

Thanks!

Here are some links that might help:

A Java implementation of RSA

Java Class - RSA Implementation

Generate an N-bit public and private RSA key and use to encrypt and decrypt a random message.

Using RSA encryption with Java - tutorial

Yes, Java has built-in support for RSA that would let you do this easily.

It also has support for arbitrary-precision integers, including a modPow operation that make it pretty easy for you to implement RSA encryption yourself.

Honestly, simply implementing RSA using BigInteger is probably easier than learning enough about the Java Cryptography Architecture to use the built-in RSA implementation.

You should be able to use the Java Cryptographic Extension that comes with Java.

For making the given numbers an RSA key convert them to BigInteger and "feed" them into a RSAPrivateKeySpec resp. RSAPublicKeySpec . Using a KeyFactory you can then make the *Spec to regular Public and private keys that can be used with all cryptographic functions within Java.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM