2 Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
4 This file is a part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or (at
9 your option) any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package gnu
.java
.security
;
42 * A placeholder for <i>names</i> and <i>literals</i> used throughout this
45 public interface Registry
49 // -------------------------------------------------------------------------
51 /** The name of our Providers. */
52 String GNU_SECURITY
= "GNU";
53 String GNU_CRYPTO
= "GNU-CRYPTO";
54 String GNU_SASL
= "GNU-SASL";
56 /** Our version number. */
57 String VERSION_STRING
= "2.1.0";
59 // Names of properties to use in Maps when initialising primitives .........
61 // Symmetric block cipher algorithms and synonyms...........................
63 String ANUBIS_CIPHER
= "anubis";
65 String BLOWFISH_CIPHER
= "blowfish";
67 String DES_CIPHER
= "des";
69 String KHAZAD_CIPHER
= "khazad";
71 String RIJNDAEL_CIPHER
= "rijndael";
73 String SERPENT_CIPHER
= "serpent";
75 String SQUARE_CIPHER
= "square";
77 String TRIPLEDES_CIPHER
= "tripledes";
79 String TWOFISH_CIPHER
= "twofish";
81 String CAST5_CIPHER
= "cast5";
83 String NULL_CIPHER
= "null";
85 /** AES is synonymous to Rijndael for 128-bit block size only. */
86 String AES_CIPHER
= "aes";
88 /** TripleDES is also known as DESede. */
89 String DESEDE_CIPHER
= "desede";
91 /** CAST5 is also known as CAST-128. */
92 String CAST128_CIPHER
= "cast128";
94 String CAST_128_CIPHER
= "cast-128";
96 // Message digest algorithms and synonyms...................................
98 String WHIRLPOOL_HASH
= "whirlpool";
100 String RIPEMD128_HASH
= "ripemd128";
102 String RIPEMD160_HASH
= "ripemd160";
104 String SHA160_HASH
= "sha-160";
106 String SHA256_HASH
= "sha-256";
108 String SHA384_HASH
= "sha-384";
110 String SHA512_HASH
= "sha-512";
112 String TIGER_HASH
= "tiger";
114 String HAVAL_HASH
= "haval";
116 String MD5_HASH
= "md5";
118 String MD4_HASH
= "md4";
120 String MD2_HASH
= "md2";
122 /** RIPEMD-128 is synonymous to RIPEMD128. */
123 String RIPEMD_128_HASH
= "ripemd-128";
125 /** RIPEMD-160 is synonymous to RIPEMD160. */
126 String RIPEMD_160_HASH
= "ripemd-160";
128 /** SHA-1 is synonymous to SHA-160. */
129 String SHA_1_HASH
= "sha-1";
131 /** SHA1 is synonymous to SHA-160. */
132 String SHA1_HASH
= "sha1";
134 /** SHA is synonymous to SHA-160. */
135 String SHA_HASH
= "sha";
137 // Symmetric block cipher modes of operations...............................
139 /** Electronic CodeBook mode. */
140 String ECB_MODE
= "ecb";
142 /** Counter (NIST) mode. */
143 String CTR_MODE
= "ctr";
145 /** Integer Counter Mode (David McGrew). */
146 String ICM_MODE
= "icm";
148 /** Output Feedback Mode (NIST). */
149 String OFB_MODE
= "ofb";
151 /** Cipher block chaining mode (NIST). */
152 String CBC_MODE
= "cbc";
154 /** Cipher feedback mode (NIST). */
155 String CFB_MODE
= "cfb";
157 /** Authenticated-Encrypted mode. */
158 String EAX_MODE
= "eax";
160 // Padding scheme names and synonyms........................................
162 /** PKCS#7 padding scheme. */
163 String PKCS7_PAD
= "pkcs7";
165 /** Trailing Bit Complement padding scheme. */
166 String TBC_PAD
= "tbc";
168 /** EME-PKCS1-v1_5 padding as described in section 7.2 in RFC-3447. */
169 String EME_PKCS1_V1_5_PAD
= "eme-pkcs1-v1.5";
171 /** SSLv3 padding scheme. */
172 String SSL3_PAD
= "ssl3";
174 /** TLSv1 padding scheme. */
175 String TLS1_PAD
= "tls1";
177 // Pseudo-random number generators..........................................
179 /** (Apparently) RC4 keystream PRNG. */
180 String ARCFOUR_PRNG
= "arcfour";
182 /** We use "rc4" as an alias for "arcfour". */
183 String RC4_PRNG
= "rc4";
185 /** PRNG based on David McGrew's Integer Counter Mode. */
186 String ICM_PRNG
= "icm";
188 /** PRNG based on a designated hash function. */
189 String MD_PRNG
= "md";
191 /** PRNG based on UMAC's Key Derivation Function. */
192 String UMAC_PRNG
= "umac-kdf";
195 * PRNG based on PBKDF2 from PKCS #5 v.2. This is suffixed with the name
196 * of a MAC to be used as a PRF.
198 String PBKDF2_PRNG_PREFIX
= "pbkdf2-";
200 /** The continuously-seeded pseudo-random number generator. */
201 String CSPRNG_PRNG
= "csprng";
203 /** The Fortuna PRNG. */
204 String FORTUNA_PRNG
= "fortuna";
206 /** The Fortuna generator PRNG. */
207 String FORTUNA_GENERATOR_PRNG
= "fortuna-generator";
209 // Asymmetric keypair generators............................................
211 String DSS_KPG
= "dss";
213 String RSA_KPG
= "rsa";
215 String DH_KPG
= "dh";
217 String SRP_KPG
= "srp";
219 /** DSA is synonymous to DSS. */
220 String DSA_KPG
= "dsa";
222 // Signature-with-appendix schemes..........................................
224 String DSS_SIG
= "dss";
226 String RSA_SIG_PREFIX
= "rsa-";
228 String RSA_PSS_ENCODING
= "pss";
230 String RSA_PSS_SIG
= RSA_SIG_PREFIX
+ RSA_PSS_ENCODING
;
232 String RSA_PKCS1_V1_5_ENCODING
= "pkcs1-v1.5";
234 String RSA_PKCS1_V1_5_SIG
= RSA_SIG_PREFIX
+ RSA_PKCS1_V1_5_ENCODING
;
236 /** DSA is synonymous to DSS. */
237 String DSA_SIG
= "dsa";
239 // Key agreement protocols .................................................
243 String ELGAMAL_KA
= "elgamal";
245 String SRP6_KA
= "srp6";
247 String SRP_SASL_KA
= "srp-sasl";
249 String SRP_TLS_KA
= "srp-tls";
251 // Keyed-Hash Message Authentication Code ..................................
253 /** Name prefix of every HMAC implementation. */
254 String HMAC_NAME_PREFIX
= "hmac-";
256 // Other MAC algorithms ....................................................
258 /** The One-key CBC MAC. */
259 String OMAC_PREFIX
= "omac-";
261 /** Message Authentication Code using Universal Hashing (Ted Krovetz). */
262 String UHASH32
= "uhash32";
264 String UMAC32
= "umac32";
266 /** The Truncated Multi-Modular Hash Function -v1 (David McGrew). */
267 String TMMH16
= "tmmh16";
269 // String TMMH32 = "tmmh32";
271 // Format IDs used to identify how we externalise asymmetric keys ..........
272 // fully-qualified names of the supported codecs
273 String RAW_ENCODING
= "gnu.crypto.raw.format";
274 String X509_ENCODING
= "gnu.crypto.x509.format";
275 String PKCS8_ENCODING
= "gnu.crypto.pkcs8.format";
276 String ASN1_ENCODING
= "gnu.crypto.asn1.format";
278 // short names of the same. used by JCE adapters
279 String RAW_ENCODING_SHORT_NAME
= "RAW";
280 String X509_ENCODING_SORT_NAME
= "X.509";
281 String PKCS8_ENCODING_SHORT_NAME
= "PKCS#8";
282 String ASN1_ENCODING_SHORT_NAME
= "ASN.1";
284 // unique identifiers of the same
285 int RAW_ENCODING_ID
= 1;
286 int X509_ENCODING_ID
= 2;
287 int PKCS8_ENCODING_ID
= 3;
288 int ASN1_ENCODING_ID
= 4;
290 // OID strings used in encoding/decoding keys
291 String DSA_OID_STRING
= "1.2.840.10040.4.1";
292 String RSA_OID_STRING
= "1.2.840.113549.1.1.1";
293 String DH_OID_STRING
= "1.2.840.10046.2.1";
295 // Magic bytes we generate/expect in externalised asymmetric keys ..........
296 // the four bytes represent G (0x47) for GNU, 1 (0x01) for Raw format,
297 // D (0x44) for DSS, R (0x52) for RSA, H (0x48) for Diffie-Hellman, or S
298 // (0x53) for SRP-6, and finally P (0x50) for Public, p (0x70) for private,
299 // or S (0x53) for signature.
300 byte[] MAGIC_RAW_DSS_PUBLIC_KEY
= new byte[] { 0x47, RAW_ENCODING_ID
, 0x44,
303 byte[] MAGIC_RAW_DSS_PRIVATE_KEY
= new byte[] { 0x47, RAW_ENCODING_ID
, 0x44,
306 byte[] MAGIC_RAW_DSS_SIGNATURE
= new byte[] { 0x47, RAW_ENCODING_ID
, 0x44,
309 byte[] MAGIC_RAW_RSA_PUBLIC_KEY
= new byte[] { 0x47, RAW_ENCODING_ID
, 0x52,
312 byte[] MAGIC_RAW_RSA_PRIVATE_KEY
= new byte[] { 0x47, RAW_ENCODING_ID
, 0x52,
315 byte[] MAGIC_RAW_RSA_PSS_SIGNATURE
= new byte[] { 0x47, RAW_ENCODING_ID
,
318 byte[] MAGIC_RAW_RSA_PKCS1V1_5_SIGNATURE
= new byte[] { 0x47, RAW_ENCODING_ID
,
321 byte[] MAGIC_RAW_DH_PUBLIC_KEY
= new byte[] { 0x47, RAW_ENCODING_ID
, 0x48,
324 byte[] MAGIC_RAW_DH_PRIVATE_KEY
= new byte[] { 0x47, RAW_ENCODING_ID
, 0x48,
327 byte[] MAGIC_RAW_SRP_PUBLIC_KEY
= new byte[] { 0x47, RAW_ENCODING_ID
, 0x53,
330 byte[] MAGIC_RAW_SRP_PRIVATE_KEY
= new byte[] { 0x47, RAW_ENCODING_ID
, 0x53,
333 // SASL Property names .....................................................
335 String SASL_PREFIX
= "gnu.crypto.sasl";
337 /** Name of username property. */
338 String SASL_USERNAME
= SASL_PREFIX
+ ".username";
340 /** Name of password property. */
341 String SASL_PASSWORD
= SASL_PREFIX
+ ".password";
343 /** Name of authentication information provider packages. */
344 String SASL_AUTH_INFO_PROVIDER_PKGS
= SASL_PREFIX
345 + ".auth.info.provider.pkgs";
347 /** SASL authorization ID. */
348 String SASL_AUTHORISATION_ID
= SASL_PREFIX
+ ".authorisation.ID";
350 /** SASL protocol. */
351 String SASL_PROTOCOL
= SASL_PREFIX
+ ".protocol";
353 /** SASL Server name. */
354 String SASL_SERVER_NAME
= SASL_PREFIX
+ ".server.name";
356 /** SASL Callback handler. */
357 String SASL_CALLBACK_HANDLER
= SASL_PREFIX
+ ".callback.handler";
359 /** SASL channel binding. */
360 String SASL_CHANNEL_BINDING
= SASL_PREFIX
+ ".channel.binding";
362 // SASL data element size limits ...........................................
364 /** The size limit, in bytes, of a SASL OS (Octet Sequence) element. */
365 int SASL_ONE_BYTE_MAX_LIMIT
= 255;
368 * The size limit, in bytes, of both a SASL MPI (Multi-Precision Integer)
369 * element and a SASL Text element.
371 int SASL_TWO_BYTE_MAX_LIMIT
= 65535;
373 /** The size limit, in bytes, of a SASL EOS (Extended Octet Sequence) element. */
374 int SASL_FOUR_BYTE_MAX_LIMIT
= 2147483383;
376 /** The size limit, in bytes, of a SASL Buffer. */
377 int SASL_BUFFER_MAX_LIMIT
= 2147483643;
379 // Canonical names of SASL mechanisms ......................................
381 String SASL_ANONYMOUS_MECHANISM
= "ANONYMOUS";
383 String SASL_CRAM_MD5_MECHANISM
= "CRAM-MD5";
385 String SASL_PLAIN_MECHANISM
= "PLAIN";
387 String SASL_SRP_MECHANISM
= "SRP";
389 // Canonical names of Integrity Protection algorithms ......................
391 String SASL_HMAC_MD5_IALG
= "HMACwithMD5";
393 String SASL_HMAC_SHA_IALG
= "HMACwithSHA";
395 // Quality Of Protection string representations ............................
397 /** authentication only. */
398 String QOP_AUTH
= "auth";
400 /** authentication plus integrity protection. */
401 String QOP_AUTH_INT
= "auth-int";
403 /** authentication plus integrity and confidentiality protection. */
404 String QOP_AUTH_CONF
= "auth-conf";
406 // SASL mechanism strength string representation ...........................
408 String STRENGTH_HIGH
= "high";
410 String STRENGTH_MEDIUM
= "medium";
412 String STRENGTH_LOW
= "low";
414 // SASL Server Authentication requirement ..................................
416 /** Server must authenticate to the client. */
417 String SERVER_AUTH_TRUE
= "true";
419 /** Server does not need to, or cannot, authenticate to the client. */
420 String SERVER_AUTH_FALSE
= "false";
422 // SASL mechanism reuse capability .........................................
424 String REUSE_TRUE
= "true";
426 String REUSE_FALSE
= "false";
428 // Keyrings ...............................................................
430 byte[] GKR_MAGIC
= new byte[] { 0x47, 0x4b, 0x52, 0x01 };
432 // Ring usage fields.
433 int GKR_PRIVATE_KEYS
= 1 << 0;
435 int GKR_PUBLIC_CREDENTIALS
= 1 << 1;
437 int GKR_CERTIFICATES
= 1 << 2;
440 int GKR_HMAC_MD5_128
= 0;
442 int GKR_HMAC_SHA_160
= 1;
444 int GKR_HMAC_MD5_96
= 2;
446 int GKR_HMAC_SHA_96
= 3;
449 int GKR_CIPHER_AES_128_OFB
= 0;
451 int GKR_CIPHER_AES_128_CBC
= 1;
454 // -------------------------------------------------------------------------