Advanced features of the Cryptography API

Lab,Cryptography

Exercise

 

Build an application that uses advanced features in the Cryptography API such as encryption, decryption, signing and verification using public key cryptography.

Prerequisite: You should have completed the lab entitled Basic encryption and decryption before starting this exercise.

 

Objectives

  • Discover how to use a PublicKey for encryption.
  • Discover how to use a PrivateKey for signing.
  • Discover how to use a PrivateKey for decryption.
  • Discover how to use a PublicKey for verification.

Setup

  1. Open AdvancedCryptoDeveloperLab_1.zip
  2. In the IDE, open the AdvancedCryptoDeveloperLab.jdw workspace
  3. Open the AdvancedCryptoDeveloperLab.java source file.

Tasks

  1. Complete the implementation of the encrypt method:
  1. Implement the encrypt method using the RSAPublicKey.
  2. Implement the sign method using the RSAPrivateKey.
  3. Implement the decrypt method using the RSAPrivateKey.
  4. Implement the verify method using the RSAPublicKey.

Note: You are required to import the net_rim_crypto.jar file into your project to access the Cryptography API.

 

Check Your Work

 

Check AdvancedCryptoDeveloperLab_2.zip

Review

 

In this exercise, you discovered the following things:

  • to use a PublicKey for encryption and for verification.
  • to use a PrivateKey for signing and for decryption.