# OpenSSL

##### Get sha256 fingerprint of cert

```
openssl x509 -noout -sha256 -fingerprint -in <file>
```

##### Utf8 output

```
-nameopt utf8
```

##### Convert RSA DER public key to PEM

```
openssl rsa -pubin -inform DER -in slot3_pub.key -outform PEM -out slot3_pub.pem
```

##### Convert DER certificate to PEM

```
openssl x509 -inform der -in cert.der -out cert.pem
```

##### Convert DER CSR to PEM

```
openssl req -inform der -in der-csr.csr -out pem-csr.pem
```

##### Get pub key of CSR

```
openssl req -pubkey -noout -in <csr-file>.csr
```

##### Get pub key from certificate

```
openssl x509 -pubkey -noout -in <cert-file>.crt
```

##### Modulus of Pub Key

```
openssl rsa -noout -text -modulus -in [public_key_filename]
```

##### Modulus of Certificate

```
openssl x509 -noout -text -modulus -in [certificate_filename]
```

##### View chained certificate

```
openssl storeutl -text -noout -certs CAFile.pem
```

##### View CSR 

```
openssl req -noout -text -in <csr-file>.csr
```

##### View PEM certificate

```
openssl x509 -in cert.pem -text -noout
```

##### View RSA public key

```
openssl rsa -pubin -in slot3_pub.pem -text
```