strongswan_algorithms.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. 'use strict';
  2. 'require baseclass';
  3. return baseclass.extend({
  4. _encryptionAlgorithms: new Map([
  5. ['3des', true],
  6. ['cast128', true],
  7. ['blowfish128', true],
  8. ['blowfish192', true],
  9. ['blowfish256', true],
  10. ['null', true],
  11. ['aes128'],
  12. ['aes192'],
  13. ['aes256'],
  14. ['aes128ctr'],
  15. ['aes192ctr'],
  16. ['aes256ctr'],
  17. ['camellia128'],
  18. ['camellia192'],
  19. ['camellia256'],
  20. ['camellia128ctr'],
  21. ['camellia192ctr'],
  22. ['camellia256ctr']
  23. ]),
  24. _authenticatedEncryptionAlgorithms: new Map([
  25. ['aes128ccm64'],
  26. ['aes192ccm64'],
  27. ['aes256ccm64'],
  28. ['aes128ccm96'],
  29. ['aes192ccm96'],
  30. ['aes256ccm96'],
  31. ['aes128ccm128'],
  32. ['aes192ccm128'],
  33. ['aes256ccm128'],
  34. ['aes128gcm64'],
  35. ['aes192gcm64'],
  36. ['aes256gcm64'],
  37. ['aes128gcm96'],
  38. ['aes192gcm96'],
  39. ['aes256gcm96'],
  40. ['aes128gcm128'],
  41. ['aes192gcm128'],
  42. ['aes256gcm128'],
  43. ['aes128gmac'],
  44. ['aes192gmac'],
  45. ['aes256gmac'],
  46. ['camellia128ccm64'],
  47. ['camellia192ccm64'],
  48. ['camellia256ccm64'],
  49. ['camellia128ccm96'],
  50. ['camellia192ccm96'],
  51. ['camellia256ccm96'],
  52. ['camellia128ccm128'],
  53. ['camellia192ccm128'],
  54. ['camellia256ccm128'],
  55. ['chacha20poly1305']
  56. ]),
  57. _hashAlgorithms: new Map([
  58. ['md5', true],
  59. ['md5_128', true],
  60. ['sha1', true],
  61. ['sha1_160', true],
  62. ['aesxcbc'],
  63. ['aescmac'],
  64. ['aes128gmac'],
  65. ['aes192gmac'],
  66. ['aes256gmac'],
  67. ['sha256'],
  68. ['sha384'],
  69. ['sha512'],
  70. ['sha256_96']
  71. ]),
  72. _dhAlgorithms: new Map([
  73. ['modp768', true],
  74. ['modp1024', true],
  75. ['modp1536', true],
  76. ['modp2048'],
  77. ['modp3072'],
  78. ['modp4096'],
  79. ['modp6144'],
  80. ['modp8192'],
  81. ['modp1024s160', true],
  82. ['modp2048s224', true],
  83. ['modp2048s256', true],
  84. ['ecp192', true],
  85. ['ecp224'],
  86. ['ecp256'],
  87. ['ecp384'],
  88. ['ecp521'],
  89. ['ecp224bp'],
  90. ['ecp256bp'],
  91. ['ecp384bp'],
  92. ['ecp512bp'],
  93. ['curve25519'],
  94. ['curve448']
  95. ]),
  96. _prfAlgorithms: new Map([
  97. ['prfmd5', true],
  98. ['prfsha1', true],
  99. ['prfaesxcbc'],
  100. ['prfaescmac'],
  101. ['prfsha256'],
  102. ['prfsha384'],
  103. ['prfsha512']
  104. ]),
  105. _getAlgorithmNames: function (algorithms) {
  106. return Array.from(algorithms.keys());
  107. },
  108. isInsecure: function (algorithmName) {
  109. return this._encryptionAlgorithms.get(algorithmName) == true
  110. || this._authenticatedEncryptionAlgorithms.get(algorithmName) == true
  111. || this._hashAlgorithms.get(algorithmName) == true
  112. || this._dhAlgorithms.get(algorithmName) == true
  113. || this._prfAlgorithms.get(algorithmName) == true;
  114. },
  115. getEncryptionAlgorithms: function () {
  116. return this._getAlgorithmNames(this._encryptionAlgorithms);
  117. },
  118. getAuthenticatedEncryptionAlgorithms: function () {
  119. return this._getAlgorithmNames(this._authenticatedEncryptionAlgorithms);
  120. },
  121. getHashAlgorithms: function () {
  122. return this._getAlgorithmNames(this._hashAlgorithms);
  123. },
  124. getDiffieHellmanAlgorithms: function () {
  125. return this._getAlgorithmNames(this._dhAlgorithms);
  126. },
  127. getPrfAlgorithms: function () {
  128. return this._getAlgorithmNames(this._prfAlgorithms);
  129. }
  130. });