3. Generate your RSA key pair using keytool -genkey option. Export your public certificate using -exportcert option. You will need to lookup keytool documentation. Encrypt your name using your private key and encryption mode "RSA/ECB/NoPadding". Submit your certificate and the binary file containing encrypted version of your name. Example to generate a RSA key pair: keytool -genkey -alias cs166 -keystore mystore.jks Example to export certificate: keytool -export -alias cs166 -keystore mystore.jks -file <yournamegoesherenospacesorspecialcharacters>.cer Example code to Base64 decode a byte array: (JDK1.8) byte[] bt = Files.readAllBytes("hw4.rsa"); byte[] btDecoded = java.util.Base64.getDecoder().decode(bt); Example sample code to get RSA public key from a certificate: static PublicKey getPublicKey() throws Exception { InputStream inStream = new FileInputStream("s166teacher.cer"); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream); PublicKey pk = cert.getPublicKey(); return pk; }
Added by Jason J.
Close
Step 1
Generate RSA key pair using keytool: - Open a command prompt or terminal. - Run the following command: ``` keytool -genkey -alias cs166 -keystore mystore.jks ``` - Follow the prompts to enter the required information, such as your name, Show moreā¦
Show all steps
Your feedback will help us improve your experience
Shreya Jain and 67 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Sri K.
Use CrypTool and encrypt your name with 3-DES in the ECB mode under the following two encryption keys: K1 = 11 22 33 44 55 66 77 88 AA BB CC DD EE FF FF FF K2 = 11 22 33 44 55 66 77 88 11 22 33 44 55 66 77 88 Decrypt resulting ciphertexts using 1-DES cipher. Provide any intermediate results that you obtain. One of the keys K1 and K2 enables "fast" decryption with the 1-DES cipher (a single application of 1-DES). Which one? Please explain your answer.
Akash M.
You have been hired to develop the One-Time Pad cipher for a company. You can use any language such as Java, Python, C++ in the development. Your implementation must consist of the following two functions: Encrypt(plaintext, key) and Decrypt(ciphertext, key). The Encrypt function returns the ciphertext of the input plaintext, and the Decrypt function returns the plaintext of the input ciphertext. The plaintext and ciphertext only consist of capital letters from 'A' to 'Z' and some spaces. You can also use a pseudo-random number function to generate the key in the program (in an ideal scenario, we need to use a genuine random number generator). Note that the key should be at least as long as the plaintext/ciphertext.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD