20145203 Experiment five Java Network programming and security experiment content
1. Master the socket program writing;
2. Mastering the use of cryptographic technology;
3. Design a secure transmission system.
Experimental requirements
1. Secure transmission based on Java socket
2, based on TCP implementation of client and server, pair programming one person responsible for the client, one person responsible for the server
3. Use Git for version control
4, select the symmetric algorithm for data encryption and decryption.
5. Select the asymmetric algorithm to distribute the key for the symmetric encryption key.
6, select the appropriate hash algorithm for integrity verification.
7. Select the appropriate algorithm to sign/verify the hash value.
Experimental steps
1, run the TCP code, I am responsible for the service side.
* * Pair partner 20145216 Shi Yao is responsible for client blog address: http://www.cnblogs.com/sjy519/p/5471476.html**
2. Set the IP address
• Open cmd, enter the ipconfig command,
3. Establish socket Object Getinetaddress (): Obtain the IP address of the remote server.
Getport (): Gets the port of the remote server.
Getlocaladdress (): Gets the client's local IP address.
Getlocalport (): Gets the client's local port.
getInputStream (): Gets the input stream. This method throws IOException if the socket has not yet been connected, or has been closed, or the input stream has been closed through the Shutdowninput () method.
Getoutputstream (): Gets the output stream, which throws IOException if the socket has not yet been connected, or has been closed, or the output stream has been closed through the Shutdownoutput () method.
4, Information security transmission:
① Sender A —————— > receiver B
②a encryption, use B's public key
③b decryption, use B's private key
20145309 Experiment 5