blob: fe0c72283ef552b83c4d8bf519bd87493b3a27da [file] [log] [blame]
Michael Hanlca740d72015-06-16 10:04:58 +02001package de.ids_mannheim.korap.interfaces;
2
Michael Hanl482f30d2015-09-25 12:39:46 +02003import de.ids_mannheim.korap.exceptions.KustvaktException;
Michael Hanlca740d72015-06-16 10:04:58 +02004import de.ids_mannheim.korap.user.User;
5
6import java.io.UnsupportedEncodingException;
7import java.security.NoSuchAlgorithmException;
8import java.util.Map;
9
10public interface EncryptionIface {
11
12 public enum Encryption {
margaretha35e1ca22023-11-16 22:00:01 +010013 @Deprecated
Michael Hanlca740d72015-06-16 10:04:58 +020014 SIMPLE, ESAPICYPHER, BCRYPT
15 }
16
17 /**
18 * One-way hashing of String input. Used to canonicalize
Michael Hanl8abaf9e2016-05-23 16:46:35 +020019 *
Michael Hanlca740d72015-06-16 10:04:58 +020020 * @param input
21 * @param salt
22 * @return
Michael Hanlca740d72015-06-16 10:04:58 +020023 */
Michael Hanlcb2d3f92016-06-02 17:34:06 +020024 public String secureHash (String input, String salt)
margaretha6d61a552018-04-10 19:26:44 +020025 throws KustvaktException;
Michael Hanlca740d72015-06-16 10:04:58 +020026
margaretha2618beb2020-01-24 14:12:28 +010027 public String secureHash (String input);
Michael Hanlca740d72015-06-16 10:04:58 +020028
Michael Hanlca740d72015-06-16 10:04:58 +020029 /**
30 * @param plain
31 * @param hash
32 * @param salt
33 * @return
34 */
Michael Hanl8abaf9e2016-05-23 16:46:35 +020035 public boolean checkHash (String plain, String hash, String salt);
Michael Hanlca740d72015-06-16 10:04:58 +020036
Michael Hanl8abaf9e2016-05-23 16:46:35 +020037 public boolean checkHash (String plain, String hash);
38
Michael Hanlca740d72015-06-16 10:04:58 +020039 /**
40 * create random String to be used as authentication token
Michael Hanl8abaf9e2016-05-23 16:46:35 +020041 *
Michael Hanlca740d72015-06-16 10:04:58 +020042 * @return
43 */
Michael Hanl8abaf9e2016-05-23 16:46:35 +020044 public String createToken (boolean hash, Object ... obj);
Michael Hanlca740d72015-06-16 10:04:58 +020045
Michael Hanl8abaf9e2016-05-23 16:46:35 +020046 public String createToken ();
47
Michael Hanlca740d72015-06-16 10:04:58 +020048 /**
49 * create a random Integer to be used as ID for databases
Michael Hanl8abaf9e2016-05-23 16:46:35 +020050 *
Michael Hanlca740d72015-06-16 10:04:58 +020051 * @return
52 */
Michael Hanl7ab5d102016-06-03 13:16:09 +020053 public String createRandomNumber (Object ... obj);
Michael Hanlca740d72015-06-16 10:04:58 +020054
Michael Hanl8abaf9e2016-05-23 16:46:35 +020055 public String encodeBase ();
Michael Hanlca740d72015-06-16 10:04:58 +020056
margaretha35e1ca22023-11-16 22:00:01 +010057 // @Deprecated
Michael Hanlc0ed00f2016-06-23 14:33:10 +020058 //public Map<String, Object> validateMap (Map<String, Object> map)
59 // throws KustvaktException;
Michael Hanlca740d72015-06-16 10:04:58 +020060
Michael Hanlc0ed00f2016-06-23 14:33:10 +020061 //@Deprecated
62 //public String validateEntry (String input, String type)
63 // throws KustvaktException;
Michael Hanl8abaf9e2016-05-23 16:46:35 +020064
Michael Hanlca740d72015-06-16 10:04:58 +020065}