policies.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * Copyright 2018 Scytl Secure Electronic Voting SA
  3. *
  4. * All rights reserved
  5. *
  6. * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
  7. */
  8. module.exports = function(Config) {
  9. return {
  10. homomorphic: {
  11. cipher: {
  12. secureRandom: {
  13. provider: Config.homomorphic.cipher.secureRandom.provider.SCYTL
  14. }
  15. }
  16. },
  17. asymmetric: {
  18. keypair: {
  19. encryption: {
  20. algorithm: Config.asymmetric.keypair.encryption.algorithm.RSA,
  21. provider: Config.asymmetric.keypair.encryption.provider.FORGE,
  22. keyLength: Config.asymmetric.keypair.encryption.keyLength.KL_2048,
  23. publicExponent: Config.asymmetric.keypair.encryption.publicExponent.F4
  24. },
  25. secureRandom: {
  26. provider: Config.asymmetric.keypair.secureRandom.provider.SCYTL
  27. }
  28. },
  29. signer: {
  30. algorithm: Config.asymmetric.signer.algorithm.RSA,
  31. provider: Config.asymmetric.signer.provider.FORGE,
  32. hash: Config.asymmetric.signer.hash.SHA256,
  33. padding: {
  34. PSS: {
  35. name: Config.asymmetric.signer.padding.PSS.name,
  36. hash: Config.asymmetric.signer.padding.PSS.hash.SHA256,
  37. mask: {
  38. MGF1: {
  39. name: Config.asymmetric.signer.padding.PSS.mask.MGF1.name,
  40. hash: Config.asymmetric.signer.padding.PSS.mask.MGF1.hash.SHA256
  41. }
  42. },
  43. saltLengthBytes: Config.asymmetric.signer.padding.PSS.saltLengthBytes.SL_32
  44. }
  45. },
  46. publicExponent: Config.asymmetric.signer.publicExponent.F4,
  47. secureRandom: {
  48. provider: Config.asymmetric.signer.secureRandom.provider.SCYTL
  49. }
  50. },
  51. cipher: {
  52. algorithm: Config.asymmetric.cipher.algorithm.RSA_KEM,
  53. secretKeyLengthBytes: Config.asymmetric.cipher.algorithm.RSA_KEM.secretKeyLengthBytes.KL_16,
  54. ivLengthBytes : Config.asymmetric.cipher.algorithm.RSA_KEM.ivLengthBytes.IV_12,
  55. tagLengthBytes : Config.asymmetric.cipher.algorithm.RSA_KEM.tagLengthBytes.TL_16,
  56. deriver: Config.asymmetric.cipher.algorithm.RSA_KEM.deriver.name.KDF1,
  57. hash: Config.asymmetric.cipher.algorithm.RSA_KEM.deriver.messagedigest.algorithm.SHA256,
  58. provider: Config.asymmetric.cipher.provider.FORGE,
  59. secureRandom: {
  60. provider: Config.asymmetric.cipher.secureRandom.provider.SCYTL
  61. }
  62. }
  63. },
  64. primitives: {
  65. secureRandom: {
  66. provider: Config.primitives.secureRandom.provider.SCYTL
  67. },
  68. messagedigest: {
  69. algorithm: Config.primitives.messagedigest.algorithm.SHA256,
  70. provider: Config.primitives.messagedigest.provider.FORGE
  71. },
  72. derivation: {
  73. pbkdf: {
  74. provider: Config.primitives.derivation.pbkdf.provider.FORGE,
  75. hash: Config.primitives.derivation.pbkdf.hash.SHA256,
  76. saltLengthBytes: Config.primitives.derivation.pbkdf.saltLengthBytes.SL_32,
  77. keyLengthBytes: Config.primitives.derivation.pbkdf.keyLengthBytes.KL_16,
  78. iterations: Config.primitives.derivation.pbkdf.iterations.I_32000
  79. }
  80. }
  81. },
  82. stores: {},
  83. symmetric: {
  84. secretkey: {
  85. encryption: {
  86. length: Config.symmetric.secretkey.encryption.lengthBytes.SK_16
  87. },
  88. mac: {
  89. length: Config.symmetric.secretkey.mac.lengthBytes.SK_32
  90. },
  91. secureRandom: {
  92. provider: Config.symmetric.secretkey.secureRandom.provider.SCYTL
  93. }
  94. },
  95. cipher: {
  96. provider: Config.symmetric.cipher.provider.FORGE,
  97. algorithm: {
  98. AES128_GCM: {
  99. name: Config.symmetric.cipher.algorithm.AES128_GCM.name,
  100. keyLengthBytes: Config.symmetric.cipher.algorithm.AES128_GCM.keyLengthBytes,
  101. tagLengthBytes: Config.symmetric.cipher.algorithm.AES128_GCM.tagLengthBytes
  102. }
  103. },
  104. initializationVectorLengthBytes: Config.symmetric.cipher.initializationVectorLengthBytes.IV_12,
  105. secureRandom: {
  106. provider: Config.symmetric.cipher.secureRandom.provider.SCYTL
  107. }
  108. },
  109. mac: {
  110. hash: Config.symmetric.mac.hash.SHA256,
  111. provider: Config.symmetric.mac.provider.FORGE
  112. }
  113. },
  114. proofs: {
  115. secureRandom: {
  116. provider: Config.proofs.secureRandom.provider.SCYTL
  117. },
  118. messagedigest: {
  119. algorithm: Config.proofs.messagedigest.algorithm.SHA256,
  120. provider: Config.proofs.messagedigest.provider.FORGE
  121. },
  122. charset: Config.proofs.charset.UTF8
  123. },
  124. digitalenvelope: {
  125. symmetric: {
  126. secretkey: {
  127. encryption: {
  128. lengthBytes: Config.symmetric.secretkey.encryption.lengthBytes.SK_16
  129. },
  130. mac: {
  131. lengthBytes: Config.symmetric.secretkey.mac.lengthBytes.SK_32
  132. },
  133. secureRandom: {
  134. provider: Config.symmetric.secretkey.secureRandom.provider.SCYTL
  135. }
  136. },
  137. cipher: {
  138. provider: Config.symmetric.cipher.provider.FORGE,
  139. algorithm: {
  140. AES128_GCM: {
  141. name: Config.symmetric.cipher.algorithm.AES128_GCM.name,
  142. keyLengthBytes: Config.symmetric.cipher.algorithm.AES128_GCM.keyLengthBytes,
  143. tagLengthBytes: Config.symmetric.cipher.algorithm.AES128_GCM.tagLengthBytes
  144. }
  145. },
  146. initializationVectorLengthBytes: Config.symmetric.cipher.initializationVectorLengthBytes.IV_12,
  147. secureRandom: {
  148. provider: Config.symmetric.cipher.secureRandom.provider.SCYTL
  149. }
  150. },
  151. mac: {
  152. hash: Config.symmetric.mac.hash.SHA256,
  153. provider: Config.symmetric.mac.provider.FORGE
  154. }
  155. },
  156. asymmetric: {
  157. cipher: {
  158. algorithm: Config.asymmetric.cipher.algorithm.RSA_KEM,
  159. secretKeyLengthBytes: Config.asymmetric.cipher.algorithm.RSA_KEM.secretKeyLengthBytes.KL_16,
  160. ivLengthBytes: Config.asymmetric.cipher.algorithm.RSA_KEM.ivLengthBytes.IVL_12,
  161. tagLengthBytes: Config.asymmetric.cipher.algorithm.RSA_KEM.tagLengthBytes.TL_16,
  162. deriver: Config.asymmetric.cipher.algorithm.RSA_KEM.deriver.name.KDF1,
  163. hash: Config.asymmetric.cipher.algorithm.RSA_KEM.deriver.messagedigest.algorithm.SHA256,
  164. symmetricCipher: Config.asymmetric.cipher.algorithm.RSA_KEM.cipher.AESGCM,
  165. provider: Config.asymmetric.cipher.provider.FORGE,
  166. secureRandom: {
  167. provider: Config.asymmetric.cipher.secureRandom.provider.SCYTL
  168. }
  169. }
  170. }
  171. }
  172. };
  173. };