CryptType.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */

  20. package org.openspcoop2.utils.crypt;

  21. import java.io.Serializable;

  22. /**
  23.  * CryptType
  24.  *
  25.  * @author Poli Andrea (apoli@link.it)
  26.  * @author $Author$
  27.  * @version $Rev$, $Date$
  28.  */
  29. public enum CryptType implements Serializable {

  30.     /*
  31.      * https://commons.apache.org/proper/commons-codec/archives/1.13/apidocs/src-html/org/apache/commons/codec/digest/Md5Crypt.html
  32.      * The libc crypt() "$1$" and Apache "$apr1$" MD5-based hash algorithm.
  33.     */
  34.     LIBC_CRYPT_MD5,  // Algorithm: MD5, Prefix: $1$
  35.     LIBC_CRYPT_MD5_APACHE,  // Algorithm: MD5, Prefix: $apr1$
  36.    
  37.     /*
  38.      * https://commons.apache.org/proper/commons-codec/archives/1.13/apidocs/src-html/org/apache/commons/codec/digest/Sha2Crypt.html
  39.      * SHA2-based Unix crypt implementation in SHA-256 e SHA-512 variant.
  40.      */
  41.     SHA2_BASED_UNIX_CRYPT_SHA256, // Algorithm: SHA256, Prefix: $5$
  42.     SHA2_BASED_UNIX_CRYPT_SHA512, // Algorithm: SHA512, Prefix: $6$
  43.    
  44.     /*
  45.      * https://commons.apache.org/proper/commons-codec/archives/1.13/apidocs/src-html/org/apache/commons/codec/digest/UnixCrypt.html
  46.      * Unix crypt(3) algorithm implementation
  47.      */
  48.     DES_UNIX_CRYPT,
  49.    
  50.     /*
  51.      * http://www.jasypt.org/api/jasypt/1.8/org/jasypt/util/password/rfc2307/package-summary.html
  52.      */
  53.     RFC2307_MD5, // Algorithm: MD5, Salt size: 0 (no salt), Iterations: 1 (no hash iteration), Prefix: {MD5}
  54.     RFC2307_SMD5, // Algorithm: MD5, Salt size: 8, Iterations: 1 (no hash iteration), Prefix: {SMD5}, Invert position of salt in message before digesting, Invert position of plain salt in encryption results, Use lenient salt size check
  55.     RFC2307_SHA, // Algorithm: SHA-1, Salt size: 0 (no salt), Iterations: 1 (no hash iteration), Prefix: {SHA}
  56.     RFC2307_SSHA, // Algorithm: SHA-1, Salt size: 8, Iterations: 1 (no hash iteration), Prefix: {SSHA}, Invert position of salt in message before digesting, Invert position of plain salt in encryption results, Use lenient salt size check
  57.    
  58.     /*
  59.      * http://www.jasypt.org/api/jasypt/1.8/org/jasypt/util/password/package-summary.html
  60.      */
  61.     JASYPT_BASIC_PASSWORD, // Algorithm: MD5, Salt size: 8, Iterations: 1000
  62.     JASYPT_STRONG_PASSWORD, // Algorithm: SHA-256, Salt size: 16, Iterations: 100000
  63.     JASYPT_CUSTOM_PASSWORD,
  64.    
  65.     /*
  66.      * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/javax/crypto/spec/PBEKeySpec.html
  67.      */
  68.     PBE_KEY_SPEC,
  69.    
  70.     B_CRYPT,
  71.    
  72.     S_CRYPT,

  73.     PLAIN;

  74. }