1
- # Encryption, signatures, keys
1
+ # openssl
2
2
3
- ## SSH
4
-
5
- ### Generate new keypair
6
-
7
- ``` bash
8
- ssh-keygen -t rsa -a 100 -b 8192
9
- ```
10
-
11
- Alternatively (though RSA 8192 _ might_ be safer):
12
- ``` bash
13
- ssh-keygen -t ed25519 -a 100
14
- ```
15
-
16
- ## Display key signature and artwork
17
-
18
- ``` bash
19
- ssh-keygen -vl -f privkey
20
- ```
21
-
22
- ## Create a public key from a private key
23
-
24
- ``` bash
25
- ssh-keygen -y -f privkey > pubkey
26
- ```
27
-
28
- ## Change (or add) passphrase for private key
29
-
30
- ``` bash
31
- ssh-keygen -p -f privkey
32
- ```
33
-
34
- ## Convert OpenSSH private key to RSA private key
35
-
36
- ``` bash
37
- # This operation overwrites the privkey file
38
- cp privkey privkey.openssh
39
- ssh-keygen -p -N " " -m pem -f privkey
40
- ```
41
-
42
- ## Convert public key to Windows-friendly
43
-
44
- You're not really using Windows, right? This is for your less-fortunate acquaintances.
45
-
46
- ``` bash
47
- ssh-keygen -e -m RFC4716 -f pubkey > pubkey.otherformat
48
- ```
49
-
50
- ## openssl
51
-
52
- ### Prepare new x509 cert
3
+ ## Prepare new x509 cert
53
4
54
5
Generate private key:
55
6
``` bash
@@ -66,7 +17,7 @@ Self-sign cert (or.. submit the CSR to your CA instead):
66
17
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.pem
67
18
```
68
19
69
- ### Inspect
20
+ ## Inspect
70
21
71
22
View PEM cert contents:
72
23
``` bash
@@ -93,7 +44,7 @@ View CSR contents:
93
44
openssl req -text -noout -verify -in server.csr
94
45
```
95
46
96
- ### Verify
47
+ ## Verify
97
48
98
49
Verify cert chain:
99
50
``` bash
@@ -106,7 +57,7 @@ openssl x509 -noout -modulus -in server.pem | openssl sha1
106
57
openssl rsa -noout -modulus -in server.key | openssl sha1
107
58
```
108
59
109
- ### Create password digests
60
+ ## Create password digests
110
61
111
62
md5 digest:
112
63
``` bash
@@ -118,7 +69,7 @@ sha512 digest:
118
69
openssl passwd -salt xxyyzz -6 ' nicer.pass'
119
70
```
120
71
121
- ### Create Java keystore
72
+ ## Create Java keystore
122
73
123
74
``` bash
124
75
# First, convert PEM file and key to PKCS12 format
@@ -156,50 +107,50 @@ keytool \
156
107
-file some-other-ca.pem
157
108
```
158
109
159
- ### View Java keystore
110
+ ## View Java keystore
160
111
161
112
``` bash
162
113
keytool -list -v -keystore server.jks -storepass ' JKS password'
163
114
```
164
115
165
- ## tcpdump
116
+ # tcpdump
166
117
167
- ### Confirm encryption on the wire
118
+ ## Confirm encryption on the wire
168
119
169
120
Note: to capture the full packet payload, the ` -s 0 ` option was required on older tcpdump versions. It is no longer necessary.
170
121
171
122
``` bash
172
123
sudo tcpdump -i ens160 -nn -A port 3306 and host 10.69.80.2
173
124
```
174
125
175
- ### Save packet capture to file
126
+ ## Save packet capture to file
176
127
177
128
``` bash
178
129
sudo tcpdump -i ens160 -w foo port 3306 and host 10.69.80.2
179
130
```
180
131
181
- ### Read packet capture data from file
132
+ ## Read packet capture data from file
182
133
183
134
``` bash
184
135
tcpdump -nn -A -r foo
185
136
```
186
137
187
- ## GNUPG
138
+ # GNUPG
188
139
189
- ### Create a new keypair
140
+ ## Create a new keypair
190
141
191
142
``` bash
192
143
gpg --full-gen-key --expert
193
144
```
194
145
195
- ### Import public key
146
+ ## Import public key
196
147
197
148
``` bash
198
149
# Example keyserver and key ID..
199
150
gpg --keyserver pgp.mit.edu --recv-keys 89ccae8b
200
151
```
201
152
202
- ### Back up and restore a keypair
153
+ ## Back up and restore a keypair
203
154
204
155
This is a cleaner approach than exporting the public key, private key, and trustdb separately
205
156
@@ -219,7 +170,7 @@ gpg> trust
219
170
gpg> quit
220
171
```
221
172
222
- ## Steganography
173
+ # Steganography
223
174
224
175
Both ` steghide ` and ` outguess ` are decent options.
225
176
0 commit comments