| 1 |
|
package org.europa.together.business; |
| 2 |
|
|
| 3 |
|
import java.security.KeyPair; |
| 4 |
|
import java.security.NoSuchAlgorithmException; |
| 5 |
|
import java.security.PrivateKey; |
| 6 |
|
import java.security.PublicKey; |
| 7 |
|
import org.apiguardian.api.API; |
| 8 |
|
import static org.apiguardian.api.API.Status.STABLE; |
| 9 |
|
import org.europa.together.domain.CipherAlgorithm; |
| 10 |
|
import org.europa.together.domain.HashAlgorithm; |
| 11 |
|
import org.europa.together.domain.RNGAlgorithm; |
| 12 |
|
import org.springframework.stereotype.Component; |
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
@author |
| 18 |
|
@version |
| 19 |
|
@since |
| 20 |
|
|
| 21 |
|
@API(status = STABLE, since = "2.0", consumers = "JavaCryptoTools") |
| 22 |
|
@Component |
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
| 23 |
|
public interface CryptoTools { |
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
@API(status = STABLE, since = "2.0") |
| 29 |
|
String FEATURE_ID = "CM-14"; |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
@param |
| 35 |
|
@param |
| 36 |
|
@return |
| 37 |
|
|
| 38 |
|
@API(status = STABLE, since = "2.0") |
| 39 |
|
String calculateHash(String plainText, HashAlgorithm algorithm); |
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
@param |
| 46 |
|
@return |
| 47 |
|
@throws |
| 48 |
|
|
| 49 |
|
@API(status = STABLE, since = "2.1") |
| 50 |
|
int getMaxKeySize(CipherAlgorithm cipher) throws NoSuchAlgorithmException; |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
@param |
| 61 |
|
@return |
| 62 |
|
|
| 63 |
|
@API(status = STABLE, since = "2.1") |
| 64 |
|
KeyPair generateCipherKeyPair(CipherAlgorithm cipher); |
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
@param |
| 74 |
|
@param |
| 75 |
|
|
| 76 |
|
@API(status = STABLE, since = "2.1") |
| 77 |
|
void saveKeyPairToFile(String path, KeyPair keyRing); |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 83 |
|
@param |
| 84 |
|
@param |
| 85 |
|
@return |
| 86 |
|
|
| 87 |
|
@API(status = STABLE, since = "2.1") |
| 88 |
|
PrivateKey loadPrivateKeyFile(String keyFile, CipherAlgorithm algorithm); |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
@param |
| 94 |
|
@param |
| 95 |
|
@return |
| 96 |
|
|
| 97 |
|
@API(status = STABLE, since = "2.1") |
| 98 |
|
PublicKey loadPublicKeyFile(String keyFile, CipherAlgorithm algorithm); |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
@param |
| 104 |
|
@return |
| 105 |
|
|
| 106 |
|
@API(status = STABLE, since = "3.2") |
| 107 |
|
double generateRandomNumber(RNGAlgorithm algortihm); |
| 108 |
|
} |