@@ -904,6 +904,41 @@ added: v0.11.4
904
904
Always returns ` true ` . This may be used to distinguish TLS sockets from regular
905
905
` net.Socket ` instances.
906
906
907
+ ### ` tlsSocket.exportKeyingMaterial(length, label[, context]) `
908
+ <!-- YAML
909
+ added:
910
+ - v13.10.0
911
+ - v12.17.0
912
+ -->
913
+
914
+ * ` length ` {number} number of bytes to retrieve from keying material
915
+ * ` label ` {string} an application specific label, typically this will be a
916
+ value from the
917
+ [ IANA Exporter Label Registry] ( https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels ) .
918
+ * ` context ` {Buffer} Optionally provide a context.
919
+
920
+ * Returns: {Buffer} requested bytes of the keying material
921
+
922
+ Keying material is used for validations to prevent different kind of attacks in
923
+ network protocols, for example in the specifications of IEEE 802.1X.
924
+
925
+ Example
926
+
927
+ ``` js
928
+ const keyingMaterial = tlsSocket .exportKeyingMaterial (
929
+ 128 ,
930
+ ' client finished' );
931
+
932
+ /**
933
+ Example return value of keyingMaterial:
934
+ <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9
935
+ 12 5a 33 b8 b5 25 df 7b 37 9f e0 e2 4f b8 67 83 a3 2f cd 5d 41 42 4c 91
936
+ 74 ef 2c ... 78 more bytes>
937
+ */
938
+ ```
939
+ See the OpenSSL [ ` SSL_export_keying_material ` ] [ ] documentation for more
940
+ information.
941
+
907
942
### ` tlsSocket.getCertificate() `
908
943
<!-- YAML
909
944
added: v11.2.0
@@ -1113,6 +1148,18 @@ provided by SSL/TLS is not desired or is not enough.
1113
1148
Corresponds to the ` SSL_get_peer_finished ` routine in OpenSSL and may be used
1114
1149
to implement the ` tls-unique ` channel binding from [ RFC 5929] [ ] .
1115
1150
1151
+ ### ` tlsSocket.getPeerX509Certificate() `
1152
+ <!-- YAML
1153
+ added: REPLACEME
1154
+ -->
1155
+
1156
+ * Returns: {X509Certificate}
1157
+
1158
+ Returns the peer certificate as an {X509Certificate} object.
1159
+
1160
+ If there is no peer certificate, or the socket has been destroyed,
1161
+ ` undefined ` will be returned.
1162
+
1116
1163
### ` tlsSocket.getProtocol() `
1117
1164
<!-- YAML
1118
1165
added: v5.7.0
@@ -1164,41 +1211,6 @@ See
1164
1211
[ SSL_get_shared_sigalgs] ( https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html )
1165
1212
for more information.
1166
1213
1167
- ### ` tlsSocket.exportKeyingMaterial(length, label[, context]) `
1168
- <!-- YAML
1169
- added:
1170
- - v13.10.0
1171
- - v12.17.0
1172
- -->
1173
-
1174
- * ` length ` {number} number of bytes to retrieve from keying material
1175
- * ` label ` {string} an application specific label, typically this will be a
1176
- value from the
1177
- [ IANA Exporter Label Registry] ( https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels ) .
1178
- * ` context ` {Buffer} Optionally provide a context.
1179
-
1180
- * Returns: {Buffer} requested bytes of the keying material
1181
-
1182
- Keying material is used for validations to prevent different kind of attacks in
1183
- network protocols, for example in the specifications of IEEE 802.1X.
1184
-
1185
- Example
1186
-
1187
- ``` js
1188
- const keyingMaterial = tlsSocket .exportKeyingMaterial (
1189
- 128 ,
1190
- ' client finished' );
1191
-
1192
- /**
1193
- Example return value of keyingMaterial:
1194
- <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9
1195
- 12 5a 33 b8 b5 25 df 7b 37 9f e0 e2 4f b8 67 83 a3 2f cd 5d 41 42 4c 91
1196
- 74 ef 2c ... 78 more bytes>
1197
- */
1198
- ```
1199
- See the OpenSSL [ ` SSL_export_keying_material ` ] [ ] documentation for more
1200
- information.
1201
-
1202
1214
### ` tlsSocket.getTLSTicket() `
1203
1215
<!-- YAML
1204
1216
added: v0.11.4
@@ -1213,6 +1225,18 @@ It may be useful for debugging.
1213
1225
1214
1226
See [ Session Resumption] [ ] for more information.
1215
1227
1228
+ ### ` tlsSocket.getX509Certificate() `
1229
+ <!-- YAML
1230
+ added: REPLACEME
1231
+ -->
1232
+
1233
+ * Returns: {X509Certificate}
1234
+
1235
+ Returns the local certificate as an {X509Certificate} object.
1236
+
1237
+ If there is no local certificate, or the socket has been destroyed,
1238
+ ` undefined ` will be returned.
1239
+
1216
1240
### ` tlsSocket.isSessionReused() `
1217
1241
<!-- YAML
1218
1242
added: v0.5.6
0 commit comments