SRPRegistry.java 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* SRPRegistry.java --
  2. Copyright (C) 2003, 2006 Free Software Foundation, Inc.
  3. This file is a part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or (at
  7. your option) any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
  15. USA
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package gnu.javax.crypto.sasl.srp;
  32. import gnu.java.security.Registry;
  33. /**
  34. * A list of key names designating the values exchanged between the server
  35. * and client in an SRP communication authentication phase.
  36. */
  37. public interface SRPRegistry
  38. {
  39. /** Indices of (N, g) parameter values for SRP (.conf) password database. */
  40. String N_2048_BITS = "1";
  41. String N_1536_BITS = "2";
  42. String N_1280_BITS = "3";
  43. String N_1024_BITS = "4";
  44. String N_768_BITS = "5";
  45. String N_640_BITS = "6";
  46. String N_512_BITS = "7";
  47. /** Available hash algorithms for all SRP calculations. */
  48. String[] SRP_ALGORITHMS = {
  49. Registry.SHA160_HASH, // the default one
  50. Registry.MD5_HASH,
  51. Registry.RIPEMD128_HASH,
  52. Registry.RIPEMD160_HASH,
  53. Registry.SHA256_HASH,
  54. Registry.SHA384_HASH,
  55. Registry.SHA512_HASH };
  56. /**
  57. * The name of the default message digest algorithm to use when no name is
  58. * explicitely given. In this implementation it is the <b>first</b> among
  59. * those supported; i.e. the algorithm at index position #0: SHA with
  60. * 160-bit output.
  61. */
  62. String SRP_DEFAULT_DIGEST_NAME = SRP_ALGORITHMS[0];
  63. /**
  64. * The property name of the message digest algorithm name to use in a given
  65. * SRP incarnation.
  66. */
  67. String SRP_DIGEST_NAME = "srp.digest.name";
  68. /** The public shared modulus: n. */
  69. String SHARED_MODULUS = "srp.N";
  70. /** The GF generator used: g. */
  71. String FIELD_GENERATOR = "srp.g";
  72. /** The list of server's available security options. */
  73. String AVAILABLE_OPTIONS = "srp.L";
  74. /** The client's chosen security options. */
  75. String CHOSEN_OPTIONS = "srp.o";
  76. /** The client's username. */
  77. String USER_NAME = "srp.U";
  78. /** The client's authorization ID. */
  79. String USER_ROLE = "srp.I";
  80. /** The user's salt. */
  81. String USER_SALT = "srp.s";
  82. /** The user's password verifier. */
  83. String PASSWORD_VERIFIER = "srp.v";
  84. /** The client's public ephemeral exponent: A. */
  85. String CLIENT_PUBLIC_KEY = "srp.A";
  86. /** The server's public ephemeral exponent: B. */
  87. String SERVER_PUBLIC_KEY = "srp.B";
  88. /** The client's evidence: M1. */
  89. String CLIENT_EVIDENCE = "srp.M1";
  90. /** The server's evidence: M2. */
  91. String SERVER_EVIDENCE = "srp.M2";
  92. /** Name of underlying hash algorithm for use with all SRP calculations. */
  93. String SRP_HASH = "gnu.crypto.sasl.srp.hash";
  94. /** Name of SRP mandatory service property. */
  95. String SRP_MANDATORY = "gnu.crypto.sasl.srp.mandatory";
  96. /** Name of SRP replay detection property. */
  97. String SRP_REPLAY_DETECTION = "gnu.crypto.sasl.srp.replay.detection";
  98. /** Name of SRP integrity protection property. */
  99. String SRP_INTEGRITY_PROTECTION = "gnu.crypto.sasl.srp.integrity";
  100. /** Name of SRP confidentiality protection property. */
  101. String SRP_CONFIDENTIALITY = "gnu.crypto.sasl.srp.confidentiality";
  102. /** Name of the main SRP password file pathname property. */
  103. String PASSWORD_FILE = "gnu.crypto.sasl.srp.password.file";
  104. /**
  105. * Name of the SRP password database property --a reference to
  106. * {@link PasswordFile} object.
  107. */
  108. String PASSWORD_DB = "gnu.crypto.sasl.srp.password.db";
  109. /** Default fully qualified pathname of the SRP password file. */
  110. String DEFAULT_PASSWORD_FILE = "/etc/tpasswd";
  111. /** Default value for replay detection security service. */
  112. boolean DEFAULT_REPLAY_DETECTION = true;
  113. /** Default value for integrity protection security service. */
  114. boolean DEFAULT_INTEGRITY = true; // implied by the previous option
  115. /** Default value for confidentiality protection security service. */
  116. boolean DEFAULT_CONFIDENTIALITY = false;
  117. // constants defining HMAC names
  118. String HMAC_SHA1 = "hmac-sha1";
  119. String HMAC_MD5 = "hmac-md5";
  120. String HMAC_RIPEMD_160 = "hmac-ripemd-160";
  121. /** Available HMAC algorithms for integrity protection. */
  122. String[] INTEGRITY_ALGORITHMS = { HMAC_SHA1, HMAC_MD5, HMAC_RIPEMD_160 };
  123. // constants defining Cipher names
  124. String AES = "aes";
  125. String BLOWFISH = "blowfish";
  126. /** Available Cipher algorithms for confidentiality protection. */
  127. String[] CONFIDENTIALITY_ALGORITHMS = { AES, BLOWFISH };
  128. /** String for mandatory replay detection. */
  129. String OPTION_MANDATORY = "mandatory";
  130. /** String for mda: the SRP digest algorithm name. */
  131. String OPTION_SRP_DIGEST = "mda";
  132. /** String for mandatory replay detection. */
  133. String OPTION_REPLAY_DETECTION = "replay_detection";
  134. /** String for mandatory integrity protection. */
  135. String OPTION_INTEGRITY = "integrity";
  136. /** String for mandatory confidentiality protection. */
  137. String OPTION_CONFIDENTIALITY = "confidentiality";
  138. /** String for mandatory replay detection. */
  139. String OPTION_MAX_BUFFER_SIZE = "maxbuffersize";
  140. /** String for no mandatory security service. */
  141. String MANDATORY_NONE = "none";
  142. /** Default mandatory security service required. */
  143. String DEFAULT_MANDATORY = OPTION_REPLAY_DETECTION;
  144. /** Name of the UID field in the plain password file. */
  145. String MD_NAME_FIELD = "srp.md.name";
  146. /** Name of the GID field in the plain password file. */
  147. String USER_VERIFIER_FIELD = "srp.user.verifier";
  148. /** Name of the GECOS field in the plain password file. */
  149. String SALT_FIELD = "srp.salt";
  150. /** Name of the SHELL field in the plain password file. */
  151. String CONFIG_NDX_FIELD = "srp.config.ndx";
  152. /** Minimum bitlength of the SRP public modulus. */
  153. int MINIMUM_MODULUS_BITLENGTH = 512;
  154. }