Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 .cer Example code to Base64 decode a byte array: (JDK1.8) bytel] bt-Files.readAllBytes( "hw4.rsa"); bytel] btDecoded java.util.Base64.getDecoder).decode(bt); Example sample code to get RSA public key from a certificate: static PublicKey getPublicKey0 throws Exception InputStream inStream-new FilelnputStream("s166teacher.cer"); CertificateFactory cf-CertificateFactory.getlnstance("X.509") X509Certificate cert = (X509Certificatelcf.generateCertificate(.nStream); PublicKey pk-cert.getPublicKey); return pk; 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 .cer Example code to Base64 decode a byte array: (JDK1.8) bytel] bt-Files.readAllBytes( "hw4.rsa"); bytel] btDecoded java.util.Base64.getDecoder).decode(bt); Example sample code to get RSA public key from a certificate: static PublicKey getPublicKey0 throws Exception InputStream inStream-new FilelnputStream("s166teacher.cer"); CertificateFactory cf-CertificateFactory.getlnstance("X.509") X509Certificate cert = (X509Certificatelcf.generateCertificate(.nStream); PublicKey pk-cert.getPublicKey); return pk

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

4. Does cultural aptitude impact ones emotional intelligence?

Answered: 1 week ago