Question: 3 . 6 Task 6 : Manually Verifying an X . 5 0 9 Certificate In this task, we will manually verify an X .
Task
: Manually Verifying an X
Certificate
In this task, we will manually verify an X
certificate using our program. An X
contains data about
a public key and an issuer
s signature on the data. We will download a real X
certific
ate from a web
server get its issuer
s public key, and then use this public key to verify the signature on the certificate.
Step
: Download a certificate from a real web server. We use the www
example.org server in
this document. Students should choose a different web server that has a different certificate than the
one used in this document
it should be noted that www
example.com share the same certificate with
www
example.org
We can download certificates using browsers or use the following command:
$ openssl s
client
connect www
example.org:
showcerts
Certificate chain
s:
C
US
ST
California
L
Los Angeles
O
Internet Corporation for Assigned
Names and Numbers
OU
Technology
CN
www
example.org
i:
C
US
O
DigiCert Inc
OU
www
digicert.com
CN
DigiCert SHA
High Assurance
Server CA
BEGIN CERTIFICATE
MIIF
jCCBNqgAwIBAgIQDmTF
I
reFLFyrrQceMsDANBgkqhkiG
w
BAQsFADBw
MQswCQYDVQQGEwJVUzEVMBMGA
UEChMMRGlnaUNlcnQgSW
jMRkwFwYDVQQLExB
wDSiIIWIWJiJGbEeIO
TIFwEVWTOnbNl
faPXpk
IRXicapqiII
END CERTIFICATE
s:
C
US
O
DigiCert Inc
OU
www
digicert.com
CN
DigiCert SHA
High
Assurance Server CA
i:
C
US
O
DigiCert Inc
OU
www
digicert.com
CN
DigiCert High Assurance
EV Root CA
BEGIN CERTIFICATE
MIIEsTCCA
mgAwIBAgIQBOHnpNxc
vNtwCtCuF
VnzANBgkqhkiG
w
BAQsFADBs
MQswCQYDVQQGEwJVUzEVMBMGA
UEChMMRGlnaUNlcnQgSW
jMRkwFwYDVQQLExB
cPUeybQ
END CERTIFICATE
The result of the command contains two certificates. The subject field
the entry starting with s:
of
the certificate is www
example.org, i
e
this is www
example.org
s certificate. The issuer field
the
entry starting with i:
provides the issuer
s information. The subject field of the second certificate is the
same as the issuer field of the first certificate. Basically, the second certificate belongs to an intermediate
CA
In this task, we will use CA
s certificate to verify a server certificate.
If you only get one certificate back using the above command, that means the certificate you get is signed
by aroot CA
Root CAs
certificates can be obtained from the Firefox browser installed in our pre
built VM
Gotothe Edit Preferences PrivacyandthenSecurity View Certificates. Search
for the name of the issuer and download its certificate.
Copy and paste each of the certificate
the text between the line containing "Begin CERTIFICATE"
and the line containing "END CERTIFICATE", including these two lines
to a file. Let us call the first one
c
pem and the second one c
pem.
Step
: Extract the public key
e
n
from the issuer
s certificate. Openssl provides commands to
extract certain attributes from the x
certificates We can extract the value of n using
modulus. There
is no specific command to extract e
but we can print out all the fields and can easily find the value of e
SEEDLabs
RSAPublic
KeyEncryptionandSignatureLab
Formodulus
n
:
$opensslx
inc
pem
noout
modulus
Printoutallthefieldsfind theexponent
e
:
$opensslx
inc
pem
text
noout
Step
:Extractthesignaturefromtheserver
scertificate
Thereisnospecificopensslcommandto
extract thesignaturefield. However,wecanprintoutall thefieldsandthencopyandpastethesignature
blockintoafile
note: ifthesignaturealgorithmusedinthecertificateisnotbasedonRSA,youcanfind
anothercertificate
$opensslx
inc
pem
text
noout
SignatureAlgorithm:sha
WithRSAEncryption
:a
:
a:
:a
:d
:bd:
b:
:
e:
:
:
b:b
:
:
d:ea:
:
:
:
:
:
f:a
:ed:
:ea:
b:
e:
b:c
:
d:
:
:
e:dd:
c:
:
:
:ce:
d:b
:
:fd:f
:
f:
e:
:
:
:
:e
:
:
aa:
a:
:
Weneedtoremovethespacesandcolonsfromthedatasowecangetahex
stringthatwecanfeedinto
ourprogramThef
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
