Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

cs166teacher.cer: https://drive.google.com/open?id=1TUkSNiBX5JVULWhGzaRiFkM11RQgdiDb hw4.rsa: https://drive.google.com/open?id=1ttJIoZEBmvUFr1okyCXOqYDv4m2ESKea C. Obtain my certificate from Files ->Cs166teacher.cer. Using my public key, decrypt the file hw4.rsa and submit what was in that

image text in transcribed

cs166teacher.cer:

https://drive.google.com/open?id=1TUkSNiBX5JVULWhGzaRiFkM11RQgdiDb

hw4.rsa:

https://drive.google.com/open?id=1ttJIoZEBmvUFr1okyCXOqYDv4m2ESKea

C. Obtain my certificate from Files ->Cs166teacher.cer. Using my public key, decrypt the file "hw4.rsa" and submit what was in that file. Note: my encryption mode: "RSA/ECB/NoPadding". Note: the hw4.rsa has been Base64 encoded. First you need to Base64 decode it to get a byte array, Note:when you decrypt, you may see a lot of leading 0 in the output Please trim them out and submit only the text message. D. 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: (UDK1.8) bytel] bt - Files.readAllBytes("hw4.rsa"); bytel] btDecoded - java.util.Base64.getDecoder0.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 = (X509 Certificate)cf.generatecertificate(.nStream); PublicKey pk cert.getPublicKey0: return pk; C. Obtain my certificate from Files ->Cs166teacher.cer. Using my public key, decrypt the file "hw4.rsa" and submit what was in that file. Note: my encryption mode: "RSA/ECB/NoPadding". Note: the hw4.rsa has been Base64 encoded. First you need to Base64 decode it to get a byte array, Note:when you decrypt, you may see a lot of leading 0 in the output Please trim them out and submit only the text message. D. 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: (UDK1.8) bytel] bt - Files.readAllBytes("hw4.rsa"); bytel] btDecoded - java.util.Base64.getDecoder0.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 = (X509 Certificate)cf.generatecertificate(.nStream); PublicKey pk cert.getPublicKey0: 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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

1. Are my sources credible?

Answered: 1 week ago

Question

3. Are my sources accurate?

Answered: 1 week ago

Question

1. Is it a topic you are interested in and know something about?

Answered: 1 week ago