UNPKG

34.7 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>JSDoc: Module: cryptoUtil</title>
6
7 <script src="scripts/prettify/prettify.js"> </script>
8 <script src="scripts/prettify/lang-css.js"> </script>
9 <!--[if lt IE 9]>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11 <![endif]-->
12 <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13 <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14</head>
15
16<body>
17
18<div id="main">
19
20 <h1 class="page-title">Module: cryptoUtil</h1>
21
22
23
24
25
26
27<section>
28
29<header>
30
31
32
33</header>
34
35<article>
36 <div class="container-overview">
37
38
39
40
41
42 </div>
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 <h3 class="subsection-title">Methods</h3>
60
61
62
63
64
65
66
67 <h4 class="name" id=".checkPasswordAll"><span class="type-signature">(static) </span>checkPasswordAll<span class="signature">(length, password)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
68
69
70
71
72
73
74<div class="description">
75 <p>Checks the generated password against common regexes.</p>
76</div>
77
78
79
80
81
82
83
84
85
86 <h5>Parameters:</h5>
87
88
89<table class="params">
90 <thead>
91 <tr>
92
93 <th>Name</th>
94
95
96 <th>Type</th>
97
98
99
100
101
102 <th class="last">Description</th>
103 </tr>
104 </thead>
105
106 <tbody>
107
108
109 <tr>
110
111 <td class="name"><code>length</code></td>
112
113
114 <td class="type">
115
116
117<span class="param-type">Number</span>
118
119
120
121 </td>
122
123
124
125
126
127 <td class="description last"><p>Number of characters in the password string.</p></td>
128 </tr>
129
130
131
132 <tr>
133
134 <td class="name"><code>password</code></td>
135
136
137 <td class="type">
138
139
140<span class="param-type">String</span>
141
142
143
144 </td>
145
146
147
148
149
150 <td class="description last"><p>Password string.</p></td>
151 </tr>
152
153
154 </tbody>
155</table>
156
157
158
159
160
161
162<dl class="details">
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195</dl>
196
197
198
199
200
201
202
203
204
205
206
207
208
209<h5>Returns:</h5>
210
211
212<div class="param-desc">
213 <p>A promise which is resolved when the password passes both checks.</p>
214</div>
215
216
217
218<dl>
219 <dt>
220 Type
221 </dt>
222 <dd>
223
224<span class="param-type">Promise</span>
225
226
227 </dd>
228</dl>
229
230
231
232
233
234
235
236
237
238
239
240
241
242 <h4 class="name" id=".checkPasswordCrack"><span class="type-signature">(static) </span>checkPasswordCrack<span class="signature">(password)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
243
244
245
246
247
248
249<div class="description">
250 <p>Checks the generated password against the cracklib library.</p>
251</div>
252
253
254
255
256
257
258
259
260
261 <h5>Parameters:</h5>
262
263
264<table class="params">
265 <thead>
266 <tr>
267
268 <th>Name</th>
269
270
271 <th>Type</th>
272
273
274
275
276
277 <th class="last">Description</th>
278 </tr>
279 </thead>
280
281 <tbody>
282
283
284 <tr>
285
286 <td class="name"><code>password</code></td>
287
288
289 <td class="type">
290
291
292<span class="param-type">String</span>
293
294
295
296 </td>
297
298
299
300
301
302 <td class="description last"><p>Password string.</p></td>
303 </tr>
304
305
306 </tbody>
307</table>
308
309
310
311
312
313
314<dl class="details">
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347</dl>
348
349
350
351
352
353
354
355
356
357
358
359
360
361<h5>Returns:</h5>
362
363
364<div class="param-desc">
365 <p>A promise which is resolved with the password or
366 rejected if an error occurs</p>
367</div>
368
369
370
371<dl>
372 <dt>
373 Type
374 </dt>
375 <dd>
376
377<span class="param-type">Promise</span>
378
379
380 </dd>
381</dl>
382
383
384
385
386
387
388
389
390
391
392
393
394
395 <h4 class="name" id=".checkPasswordStrength"><span class="type-signature">(static) </span>checkPasswordStrength<span class="signature">(length, password)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
396
397
398
399
400
401
402<div class="description">
403 <p>Checks the generated password against common regexes.</p>
404</div>
405
406
407
408
409
410
411
412
413
414 <h5>Parameters:</h5>
415
416
417<table class="params">
418 <thead>
419 <tr>
420
421 <th>Name</th>
422
423
424 <th>Type</th>
425
426
427
428
429
430 <th class="last">Description</th>
431 </tr>
432 </thead>
433
434 <tbody>
435
436
437 <tr>
438
439 <td class="name"><code>length</code></td>
440
441
442 <td class="type">
443
444
445<span class="param-type">Number</span>
446
447
448
449 </td>
450
451
452
453
454
455 <td class="description last"><p>Number of characters in the password string.</p></td>
456 </tr>
457
458
459
460 <tr>
461
462 <td class="name"><code>password</code></td>
463
464
465 <td class="type">
466
467
468<span class="param-type">String</span>
469
470
471
472 </td>
473
474
475
476
477
478 <td class="description last"><p>Password string.</p></td>
479 </tr>
480
481
482 </tbody>
483</table>
484
485
486
487
488
489
490<dl class="details">
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523</dl>
524
525
526
527
528
529
530
531
532
533
534
535
536
537<h5>Returns:</h5>
538
539
540<div class="param-desc">
541 <p>A promise which is resolved with the password or
542 rejected if an error occurs</p>
543</div>
544
545
546
547<dl>
548 <dt>
549 Type
550 </dt>
551 <dd>
552
553<span class="param-type">Promise</span>
554
555
556 </dd>
557</dl>
558
559
560
561
562
563
564
565
566
567
568
569
570
571 <h4 class="name" id=".createRandomUser"><span class="type-signature">(static) </span>createRandomUser<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
572
573
574
575
576
577
578<div class="description">
579 <p>Creates a random on BIG-IP/BIG-IQ.</p>
580<p>Only works if running on the device, not remotely.</p>
581</div>
582
583
584
585
586
587
588
589
590
591
592
593
594
595<dl class="details">
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628</dl>
629
630
631
632
633
634
635
636
637
638
639
640
641
642<h5>Returns:</h5>
643
644
645<div class="param-desc">
646 <p>A promise which is resolved with user credentials
647 or rejected if an error occurs. Credentials are in
648 the form:</p>
649<pre class="prettyprint source"><code>{
650 user: user,
651 password: password
652}</code></pre>
653</div>
654
655
656
657<dl>
658 <dt>
659 Type
660 </dt>
661 <dd>
662
663<span class="param-type">Promise</span>
664
665
666 </dd>
667</dl>
668
669
670
671
672
673
674
675
676
677
678
679
680
681 <h4 class="name" id=".decrypt"><span class="type-signature">(static) </span>decrypt<span class="signature">(privateKeyInFile, data, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
682
683
684
685
686
687
688<div class="description">
689 <p>Decrypts data with a private key</p>
690<p>If there is an encrypted passphrase, this only works when running on the BIG-IP on
691which the private key was installed.</p>
692</div>
693
694
695
696
697
698
699
700
701
702 <h5>Parameters:</h5>
703
704
705<table class="params">
706 <thead>
707 <tr>
708
709 <th>Name</th>
710
711
712 <th>Type</th>
713
714
715 <th>Attributes</th>
716
717
718
719
720 <th class="last">Description</th>
721 </tr>
722 </thead>
723
724 <tbody>
725
726
727 <tr>
728
729 <td class="name"><code>privateKeyInFile</code></td>
730
731
732 <td class="type">
733
734
735<span class="param-type">String</span>
736
737
738
739 </td>
740
741
742 <td class="attributes">
743
744
745
746
747
748 </td>
749
750
751
752
753 <td class="description last"><p>Full path to private key</p></td>
754 </tr>
755
756
757
758 <tr>
759
760 <td class="name"><code>data</code></td>
761
762
763 <td class="type">
764
765
766<span class="param-type">String</span>
767
768
769
770 </td>
771
772
773 <td class="attributes">
774
775
776
777
778
779 </td>
780
781
782
783
784 <td class="description last"><p>Base64 encoded version of the data to decrypt</p></td>
785 </tr>
786
787
788
789 <tr>
790
791 <td class="name"><code>options</code></td>
792
793
794 <td class="type">
795
796
797<span class="param-type">Object</span>
798
799
800
801 </td>
802
803
804 <td class="attributes">
805
806 &lt;optional><br>
807
808
809
810
811
812 </td>
813
814
815
816
817 <td class="description last"><p>Optional arguments</p>
818 <h6>Properties</h6>
819
820
821<table class="params">
822 <thead>
823 <tr>
824
825 <th>Name</th>
826
827
828 <th>Type</th>
829
830
831 <th>Attributes</th>
832
833
834
835
836 <th class="last">Description</th>
837 </tr>
838 </thead>
839
840 <tbody>
841
842
843 <tr>
844
845 <td class="name"><code>passphrase</code></td>
846
847
848 <td class="type">
849
850
851<span class="param-type">String</span>
852
853
854
855 </td>
856
857
858 <td class="attributes">
859
860 &lt;optional><br>
861
862
863
864
865
866 </td>
867
868
869
870
871 <td class="description last"><p>Passphrase for private key. Default no passphrase.</p></td>
872 </tr>
873
874
875
876 <tr>
877
878 <td class="name"><code>passphraseEncrypted</code></td>
879
880
881 <td class="type">
882
883
884<span class="param-type">Boolean</span>
885
886
887
888 </td>
889
890
891 <td class="attributes">
892
893 &lt;optional><br>
894
895
896
897
898
899 </td>
900
901
902
903
904 <td class="description last"><p>If there is a passphrase, whether or not it
905 is encrypted (by MCP). Default false.</p></td>
906 </tr>
907
908
909 </tbody>
910</table>
911
912 </td>
913 </tr>
914
915
916 </tbody>
917</table>
918
919
920
921
922
923
924<dl class="details">
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957</dl>
958
959
960
961
962
963
964
965
966
967
968
969
970
971<h5>Returns:</h5>
972
973
974<div class="param-desc">
975 <p>A promise which is resolve with a string version of the decrypted
976 data, or rejected if an error occurs.</p>
977</div>
978
979
980
981<dl>
982 <dt>
983 Type
984 </dt>
985 <dd>
986
987<span class="param-type">Promise</span>
988
989
990 </dd>
991</dl>
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005 <h4 class="name" id=".encrypt"><span class="type-signature">(static) </span>encrypt<span class="signature">(publicKeyDataOrFile, data)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1006
1007
1008
1009
1010
1011
1012<div class="description">
1013 <p>Encrypts data with a public key</p>
1014</div>
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024 <h5>Parameters:</h5>
1025
1026
1027<table class="params">
1028 <thead>
1029 <tr>
1030
1031 <th>Name</th>
1032
1033
1034 <th>Type</th>
1035
1036
1037
1038
1039
1040 <th class="last">Description</th>
1041 </tr>
1042 </thead>
1043
1044 <tbody>
1045
1046
1047 <tr>
1048
1049 <td class="name"><code>publicKeyDataOrFile</code></td>
1050
1051
1052 <td class="type">
1053
1054
1055<span class="param-type">String</span>
1056
1057
1058
1059 </td>
1060
1061
1062
1063
1064
1065 <td class="description last"><p>Either the public key, or the full path to
1066 a file containing the public key</p></td>
1067 </tr>
1068
1069
1070
1071 <tr>
1072
1073 <td class="name"><code>data</code></td>
1074
1075
1076 <td class="type">
1077
1078
1079<span class="param-type">String</span>
1080
1081
1082
1083 </td>
1084
1085
1086
1087
1088
1089 <td class="description last"><p>String version of the data to encrypt</p></td>
1090 </tr>
1091
1092
1093 </tbody>
1094</table>
1095
1096
1097
1098
1099
1100
1101<dl class="details">
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134</dl>
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148<h5>Returns:</h5>
1149
1150
1151<div class="param-desc">
1152 <p>A promise which is resolved with a base64 encoded version
1153 of the encrypted data, or rejected if an error occurs.</p>
1154</div>
1155
1156
1157
1158<dl>
1159 <dt>
1160 Type
1161 </dt>
1162 <dd>
1163
1164<span class="param-type">Promise</span>
1165
1166
1167 </dd>
1168</dl>
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182 <h4 class="name" id=".generateKeyPair"><span class="type-signature">(static) </span>generateKeyPair<span class="signature">(privateKeyOutFile, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1183
1184
1185
1186
1187
1188
1189<div class="description">
1190 <p>Generates a public/private key pair.</p>
1191</div>
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201 <h5>Parameters:</h5>
1202
1203
1204<table class="params">
1205 <thead>
1206 <tr>
1207
1208 <th>Name</th>
1209
1210
1211 <th>Type</th>
1212
1213
1214 <th>Attributes</th>
1215
1216
1217
1218
1219 <th class="last">Description</th>
1220 </tr>
1221 </thead>
1222
1223 <tbody>
1224
1225
1226 <tr>
1227
1228 <td class="name"><code>privateKeyOutFile</code></td>
1229
1230
1231 <td class="type">
1232
1233
1234<span class="param-type">String</span>
1235
1236
1237
1238 </td>
1239
1240
1241 <td class="attributes">
1242
1243
1244
1245
1246
1247 </td>
1248
1249
1250
1251
1252 <td class="description last"><p>Full path where private key will be written</p></td>
1253 </tr>
1254
1255
1256
1257 <tr>
1258
1259 <td class="name"><code>options</code></td>
1260
1261
1262 <td class="type">
1263
1264
1265<span class="param-type">Object</span>
1266
1267
1268
1269 </td>
1270
1271
1272 <td class="attributes">
1273
1274 &lt;optional><br>
1275
1276
1277
1278
1279
1280 </td>
1281
1282
1283
1284
1285 <td class="description last"><p>Optional arguments</p>
1286 <h6>Properties</h6>
1287
1288
1289<table class="params">
1290 <thead>
1291 <tr>
1292
1293 <th>Name</th>
1294
1295
1296 <th>Type</th>
1297
1298
1299 <th>Attributes</th>
1300
1301
1302
1303
1304 <th class="last">Description</th>
1305 </tr>
1306 </thead>
1307
1308 <tbody>
1309
1310
1311 <tr>
1312
1313 <td class="name"><code>keyLength</code></td>
1314
1315
1316 <td class="type">
1317
1318
1319<span class="param-type">String</span>
1320
1321
1322
1323 </td>
1324
1325
1326 <td class="attributes">
1327
1328 &lt;optional><br>
1329
1330
1331
1332
1333
1334 </td>
1335
1336
1337
1338
1339 <td class="description last"><p>Key length. Default is 2048.</p></td>
1340 </tr>
1341
1342
1343
1344 <tr>
1345
1346 <td class="name"><code>publicKeyOutFile</code></td>
1347
1348
1349 <td class="type">
1350
1351
1352<span class="param-type">String</span>
1353
1354
1355
1356 </td>
1357
1358
1359 <td class="attributes">
1360
1361 &lt;optional><br>
1362
1363
1364
1365
1366
1367 </td>
1368
1369
1370
1371
1372 <td class="description last"><p>Full path where public key certificate will be written.
1373 Default is to resolve with the public key.</p></td>
1374 </tr>
1375
1376
1377
1378 <tr>
1379
1380 <td class="name"><code>passphrase</code></td>
1381
1382
1383 <td class="type">
1384
1385
1386<span class="param-type">String</span>
1387
1388
1389
1390 </td>
1391
1392
1393 <td class="attributes">
1394
1395 &lt;optional><br>
1396
1397
1398
1399
1400
1401 </td>
1402
1403
1404
1405
1406 <td class="description last"><p>Passphrase for private key. Default no passphrase.</p></td>
1407 </tr>
1408
1409
1410 </tbody>
1411</table>
1412
1413 </td>
1414 </tr>
1415
1416
1417 </tbody>
1418</table>
1419
1420
1421
1422
1423
1424
1425<dl class="details">
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458</dl>
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472<h5>Returns:</h5>
1473
1474
1475<div class="param-desc">
1476 <p>A promise which will be resolved when the data is written or rejected
1477 if an error occurs. If options.publicKeyOutFile is not provided, promise
1478 is resolved with the public key.</p>
1479</div>
1480
1481
1482
1483<dl>
1484 <dt>
1485 Type
1486 </dt>
1487 <dd>
1488
1489<span class="param-type">Promise</span>
1490
1491
1492 </dd>
1493</dl>
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507 <h4 class="name" id=".generateRandomBytes"><span class="type-signature">(static) </span>generateRandomBytes<span class="signature">(length, encoding)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1508
1509
1510
1511
1512
1513
1514<div class="description">
1515 <p>Generates random bytes of a certain length and encoding</p>
1516<p>Note: If encoding is 'base64' and length is not a multiple of 6,
1517 the returned bytes will always end in '=' or '==', which decreases
1518 randomness.</p>
1519</div>
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529 <h5>Parameters:</h5>
1530
1531
1532<table class="params">
1533 <thead>
1534 <tr>
1535
1536 <th>Name</th>
1537
1538
1539 <th>Type</th>
1540
1541
1542
1543
1544
1545 <th class="last">Description</th>
1546 </tr>
1547 </thead>
1548
1549 <tbody>
1550
1551
1552 <tr>
1553
1554 <td class="name"><code>length</code></td>
1555
1556
1557 <td class="type">
1558
1559
1560<span class="param-type">Number</span>
1561
1562
1563
1564 </td>
1565
1566
1567
1568
1569
1570 <td class="description last"><p>Number of random bytes to generate.</p></td>
1571 </tr>
1572
1573
1574
1575 <tr>
1576
1577 <td class="name"><code>encoding</code></td>
1578
1579
1580 <td class="type">
1581
1582
1583<span class="param-type">String</span>
1584
1585
1586
1587 </td>
1588
1589
1590
1591
1592
1593 <td class="description last"><p>Encoding to use ('ascii', 'base64', 'hex', etc)</p></td>
1594 </tr>
1595
1596
1597 </tbody>
1598</table>
1599
1600
1601
1602
1603
1604
1605<dl class="details">
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638</dl>
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652<h5>Returns:</h5>
1653
1654
1655<div class="param-desc">
1656 <p>A promise which is resolved with the random bytes or
1657 rejected if an error occurs</p>
1658</div>
1659
1660
1661
1662<dl>
1663 <dt>
1664 Type
1665 </dt>
1666 <dd>
1667
1668<span class="param-type">Promise</span>
1669
1670
1671 </dd>
1672</dl>
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686 <h4 class="name" id=".generateRandomIntInRange"><span class="type-signature">(static) </span>generateRandomIntInRange<span class="signature">(minimum, maximum)</span><span class="type-signature"> &rarr; {Number}</span></h4>
1687
1688
1689
1690
1691
1692
1693<div class="description">
1694 <p>Generate a random integer in a range</p>
1695<p>This code courtesy of https://stackoverflow.com/a/33627342</p>
1696</div>
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706 <h5>Parameters:</h5>
1707
1708
1709<table class="params">
1710 <thead>
1711 <tr>
1712
1713 <th>Name</th>
1714
1715
1716 <th>Type</th>
1717
1718
1719
1720
1721
1722 <th class="last">Description</th>
1723 </tr>
1724 </thead>
1725
1726 <tbody>
1727
1728
1729 <tr>
1730
1731 <td class="name"><code>minimum</code></td>
1732
1733
1734 <td class="type">
1735
1736
1737<span class="param-type">Number</span>
1738
1739
1740
1741 </td>
1742
1743
1744
1745
1746
1747 <td class="description last"><p>Lowest number to generate</p></td>
1748 </tr>
1749
1750
1751
1752 <tr>
1753
1754 <td class="name"><code>maximum</code></td>
1755
1756
1757 <td class="type">
1758
1759
1760<span class="param-type">Number</span>
1761
1762
1763
1764 </td>
1765
1766
1767
1768
1769
1770 <td class="description last"><p>Highest number to generate</p></td>
1771 </tr>
1772
1773
1774 </tbody>
1775</table>
1776
1777
1778
1779
1780
1781
1782<dl class="details">
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815</dl>
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829<h5>Returns:</h5>
1830
1831
1832<div class="param-desc">
1833 <ul>
1834<li>A random number in the specified range</li>
1835</ul>
1836</div>
1837
1838
1839
1840<dl>
1841 <dt>
1842 Type
1843 </dt>
1844 <dd>
1845
1846<span class="param-type">Number</span>
1847
1848
1849 </dd>
1850</dl>
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864 <h4 class="name" id=".nextRandomUser"><span class="type-signature">(static) </span>nextRandomUser<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1865
1866
1867
1868
1869
1870
1871<div class="description">
1872 <p>Runs the create random user function on BIG-IP/BIG-IQ until valid credentials are returned.</p>
1873</div>
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887<dl class="details">
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920</dl>
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934<h5>Returns:</h5>
1935
1936
1937<div class="param-desc">
1938 <p>A promise which is resolved with user credentials
1939 or re-runs createRandomUser if an error occurs. Credentials are in
1940 the form:</p>
1941<pre class="prettyprint source"><code>{
1942 user: user,
1943 password: password
1944}</code></pre>
1945</div>
1946
1947
1948
1949<dl>
1950 <dt>
1951 Type
1952 </dt>
1953 <dd>
1954
1955<span class="param-type">Promise</span>
1956
1957
1958 </dd>
1959</dl>
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973 <h4 class="name" id=".symmetricDecrypt"><span class="type-signature">(static) </span>symmetricDecrypt<span class="signature">(privateKeyFile, encryptedKey, iv, data, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
1974
1975
1976
1977
1978
1979
1980<div class="description">
1981 <p>Decrypts data that was encrypted with symmetric encryption</p>
1982</div>
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992 <h5>Parameters:</h5>
1993
1994
1995<table class="params">
1996 <thead>
1997 <tr>
1998
1999 <th>Name</th>
2000
2001
2002 <th>Type</th>
2003
2004
2005 <th>Attributes</th>
2006
2007
2008
2009
2010 <th class="last">Description</th>
2011 </tr>
2012 </thead>
2013
2014 <tbody>
2015
2016
2017 <tr>
2018
2019 <td class="name"><code>privateKeyFile</code></td>
2020
2021
2022 <td class="type">
2023
2024
2025<span class="param-type">String</span>
2026
2027
2028
2029 </td>
2030
2031
2032 <td class="attributes">
2033
2034
2035
2036
2037
2038 </td>
2039
2040
2041
2042
2043 <td class="description last"><p>The private key file matching the public key
2044 that was used to encrypte the symmetric key.</p></td>
2045 </tr>
2046
2047
2048
2049 <tr>
2050
2051 <td class="name"><code>encryptedKey</code></td>
2052
2053
2054 <td class="type">
2055
2056
2057<span class="param-type">String</span>
2058
2059
2060
2061 </td>
2062
2063
2064 <td class="attributes">
2065
2066
2067
2068
2069
2070 </td>
2071
2072
2073
2074
2075 <td class="description last"><p>The encrypted symmetric key.</p></td>
2076 </tr>
2077
2078
2079
2080 <tr>
2081
2082 <td class="name"><code>iv</code></td>
2083
2084
2085 <td class="type">
2086
2087
2088<span class="param-type">String</span>
2089|
2090
2091<span class="param-type">Buffer</span>
2092
2093
2094
2095 </td>
2096
2097
2098 <td class="attributes">
2099
2100
2101
2102
2103
2104 </td>
2105
2106
2107
2108
2109 <td class="description last"><p>The initialization vector that was used for
2110 encryption.</p></td>
2111 </tr>
2112
2113
2114
2115 <tr>
2116
2117 <td class="name"><code>data</code></td>
2118
2119
2120 <td class="type">
2121
2122
2123<span class="param-type">String</span>
2124
2125
2126
2127 </td>
2128
2129
2130 <td class="attributes">
2131
2132
2133
2134
2135
2136 </td>
2137
2138
2139
2140
2141 <td class="description last"><p>Data to decrypt.</p></td>
2142 </tr>
2143
2144
2145
2146 <tr>
2147
2148 <td class="name"><code>options</code></td>
2149
2150
2151 <td class="type">
2152
2153
2154<span class="param-type">Object</span>
2155
2156
2157
2158 </td>
2159
2160
2161 <td class="attributes">
2162
2163 &lt;optional><br>
2164
2165
2166
2167
2168
2169 </td>
2170
2171
2172
2173
2174 <td class="description last"><p>Optional arguments</p>
2175 <h6>Properties</h6>
2176
2177
2178<table class="params">
2179 <thead>
2180 <tr>
2181
2182 <th>Name</th>
2183
2184
2185 <th>Type</th>
2186
2187
2188 <th>Attributes</th>
2189
2190
2191
2192
2193 <th class="last">Description</th>
2194 </tr>
2195 </thead>
2196
2197 <tbody>
2198
2199
2200 <tr>
2201
2202 <td class="name"><code>inputEncoding</code></td>
2203
2204
2205 <td class="type">
2206
2207
2208<span class="param-type">String</span>
2209
2210
2211
2212 </td>
2213
2214
2215 <td class="attributes">
2216
2217 &lt;optional><br>
2218
2219
2220
2221
2222
2223 </td>
2224
2225
2226
2227
2228 <td class="description last"><p>Encoding of the encrypted output. Default is base64.</p></td>
2229 </tr>
2230
2231
2232
2233 <tr>
2234
2235 <td class="name"><code>passphrase</code></td>
2236
2237
2238 <td class="type">
2239
2240
2241<span class="param-type">String</span>
2242
2243
2244
2245 </td>
2246
2247
2248 <td class="attributes">
2249
2250 &lt;optional><br>
2251
2252
2253
2254
2255
2256 </td>
2257
2258
2259
2260
2261 <td class="description last"><p>Passphrase for private key. Default no passphrase.</p></td>
2262 </tr>
2263
2264
2265
2266 <tr>
2267
2268 <td class="name"><code>passphraseEncrypted</code></td>
2269
2270
2271 <td class="type">
2272
2273
2274<span class="param-type">Boolean</span>
2275
2276
2277
2278 </td>
2279
2280
2281 <td class="attributes">
2282
2283 &lt;optional><br>
2284
2285
2286
2287
2288
2289 </td>
2290
2291
2292
2293
2294 <td class="description last"><p>If there is a passphrase, whether or not it</p></td>
2295 </tr>
2296
2297
2298 </tbody>
2299</table>
2300
2301 </td>
2302 </tr>
2303
2304
2305 </tbody>
2306</table>
2307
2308
2309
2310
2311
2312
2313<dl class="details">
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346</dl>
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371 <h4 class="name" id=".symmetricEncrypt"><span class="type-signature">(static) </span>symmetricEncrypt<span class="signature">(publicKeyDataOrFile, data, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
2372
2373
2374
2375
2376
2377
2378<div class="description">
2379 <p>Encrypts data using symmetric encryption</p>
2380<p>A random symmetric key will be generated and encrypted using the public key.
2381The data will then be encrypted using the symmetric key. Encrypted symmetric
2382key will be returned with the data.</p>
2383</div>
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393 <h5>Parameters:</h5>
2394
2395
2396<table class="params">
2397 <thead>
2398 <tr>
2399
2400 <th>Name</th>
2401
2402
2403 <th>Type</th>
2404
2405
2406 <th>Attributes</th>
2407
2408
2409
2410
2411 <th class="last">Description</th>
2412 </tr>
2413 </thead>
2414
2415 <tbody>
2416
2417
2418 <tr>
2419
2420 <td class="name"><code>publicKeyDataOrFile</code></td>
2421
2422
2423 <td class="type">
2424
2425
2426<span class="param-type">String</span>
2427
2428
2429
2430 </td>
2431
2432
2433 <td class="attributes">
2434
2435
2436
2437
2438
2439 </td>
2440
2441
2442
2443
2444 <td class="description last"><p>Either the public key, or the full path to
2445 a file containing the public key. The symmetric
2446 key will be encrypted with this key.</p></td>
2447 </tr>
2448
2449
2450
2451 <tr>
2452
2453 <td class="name"><code>data</code></td>
2454
2455
2456 <td class="type">
2457
2458
2459<span class="param-type">String</span>
2460|
2461
2462<span class="param-type">Buffer</span>
2463
2464
2465
2466 </td>
2467
2468
2469 <td class="attributes">
2470
2471
2472
2473
2474
2475 </td>
2476
2477
2478
2479
2480 <td class="description last"><p>String version of the data to encrypt</p></td>
2481 </tr>
2482
2483
2484
2485 <tr>
2486
2487 <td class="name"><code>options</code></td>
2488
2489
2490 <td class="type">
2491
2492
2493<span class="param-type">Object</span>
2494
2495
2496
2497 </td>
2498
2499
2500 <td class="attributes">
2501
2502 &lt;optional><br>
2503
2504
2505
2506
2507
2508 </td>
2509
2510
2511
2512
2513 <td class="description last"><p>Optional parameters</p>
2514 <h6>Properties</h6>
2515
2516
2517<table class="params">
2518 <thead>
2519 <tr>
2520
2521 <th>Name</th>
2522
2523
2524 <th>Type</th>
2525
2526
2527 <th>Attributes</th>
2528
2529
2530
2531
2532 <th class="last">Description</th>
2533 </tr>
2534 </thead>
2535
2536 <tbody>
2537
2538
2539 <tr>
2540
2541 <td class="name"><code>encoding</code></td>
2542
2543
2544 <td class="type">
2545
2546
2547<span class="param-type">String</span>
2548
2549
2550
2551 </td>
2552
2553
2554 <td class="attributes">
2555
2556 &lt;optional><br>
2557
2558
2559
2560
2561
2562 </td>
2563
2564
2565
2566
2567 <td class="description last"><p>Encoding for encrypted output. Default is base64.</p></td>
2568 </tr>
2569
2570
2571 </tbody>
2572</table>
2573
2574 </td>
2575 </tr>
2576
2577
2578 </tbody>
2579</table>
2580
2581
2582
2583
2584
2585
2586<dl class="details">
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619</dl>
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633<h5>Returns:</h5>
2634
2635
2636<div class="param-desc">
2637 <p>A promise which is resolved with a base64 encoded version
2638 of the encrypted data, the encrypted symmetric key, and
2639 then initialization vector, or rejected
2640 if an error occurs. Resolved data is:</p>
2641<pre class="prettyprint source"><code>{
2642 encryptedKey: &lt;encryptedKey>,
2643 iv: &lt;initializationVector>,
2644 encryptedData: &lt;base64_encoded_encryptedData>
2645}</code></pre>
2646</div>
2647
2648
2649
2650<dl>
2651 <dt>
2652 Type
2653 </dt>
2654 <dd>
2655
2656<span class="param-type">Promise</span>
2657
2658
2659 </dd>
2660</dl>
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674</article>
2675
2676</section>
2677
2678
2679
2680
2681</div>
2682
2683<nav>
2684 <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-authn.html">authn</a></li><li><a href="module-bigIqLicenseProviderFactory.html">bigIqLicenseProviderFactory</a></li><li><a href="module-cryptoUtil.html">cryptoUtil</a></li><li><a href="module-httpUtil.html">httpUtil</a></li><li><a href="module-ipc.html">ipc</a></li><li><a href="module-localCryptoUtil.html">localCryptoUtil</a></li><li><a href="module-localKeyUtil.html">localKeyUtil</a></li><li><a href="module-logger.html">logger</a></li><li><a href="module-metricsCollector.html">metricsCollector</a></li><li><a href="module-sharedConstants.html">sharedConstants</a></li><li><a href="module-signals.html">signals</a></li><li><a href="module-util.html">util</a></li></ul><h3>Classes</h3><ul><li><a href="BigIp.html">BigIp</a></li><li><a href="BigIpCluster.html">BigIpCluster</a></li><li><a href="BigIpGtm.html">BigIpGtm</a></li><li><a href="BigIpOnboard.html">BigIpOnboard</a></li><li><a href="BigIq.html">BigIq</a></li><li><a href="BigIq50LicenseProvider.html">BigIq50LicenseProvider</a></li><li><a href="BigIq52LicenseProvider.html">BigIq52LicenseProvider</a></li><li><a href="BigIq53LicenseProvider.html">BigIq53LicenseProvider</a></li><li><a href="BigIq54LicenseProvider.html">BigIq54LicenseProvider</a></li><li><a href="CloudProvider.html">CloudProvider</a></li><li><a href="DnsProvider.html">DnsProvider</a></li><li><a href="GenericNodeProvider.html">GenericNodeProvider</a></li><li><a href="GtmDnsProvider.html">GtmDnsProvider</a></li><li><a href="IControl.html">IControl</a></li></ul><h3>Mixins</h3><ul><li><a href="bigIqClusterMixins.html">bigIqClusterMixins</a></li><li><a href="bigIqOnboardMixins.html">bigIqOnboardMixins</a></li></ul><h3>Global</h3><ul><li><a href="global.html#checkTask">checkTask</a></li><li><a href="global.html#forceResetUserPassword">forceResetUserPassword</a></li><li><a href="global.html#getDataFromPropPath">getDataFromPropPath</a></li><li><a href="global.html#getLicenseProvider">getLicenseProvider</a></li></ul>
2685</nav>
2686
2687<br class="clear">
2688
2689<footer>
2690 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
2691</footer>
2692
2693<script> prettyPrint(); </script>
2694<script src="scripts/linenumber.js"> </script>
2695</body>
2696</html>
\No newline at end of file