1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
package com.netscape.certsrv.util;
import java.security.PublicKey;
import org.mozilla.jss.crypto.EncryptionAlgorithm;
import org.mozilla.jss.crypto.KeyWrapAlgorithm;
import org.mozilla.jss.crypto.SymmetricKey;
/**
* An abstract class defining the functionality to be provided by
* sub classes to perform cryptographic operations.
*
* @author akoneru
*
*/
public abstract class CryptoProvider {
public abstract void initialize() throws Exception;
public abstract SymmetricKey generateSymmetricKey(String keyAlgorithm, int keySize) throws Exception;
public abstract SymmetricKey generateSessionKey() throws Exception;
public abstract SymmetricKey generateSessionKey(EncryptionAlgorithm algorithm) throws Exception;
public abstract byte[] wrapSessionKeyWithTransportCert(SymmetricKey sessionKey, String transportCert)
throws Exception;
public abstract byte[] wrapWithSessionKey(String passphrase, byte[] iv, SymmetricKey key, String keyAlgorithm)
throws Exception;
public abstract byte[] wrapWithSessionKey(String passphrase, byte[] iv, SymmetricKey key, EncryptionAlgorithm keyAlgorithm)
throws Exception;
public abstract byte[] wrapWithSessionKey(SymmetricKey secret, SymmetricKey sessionKey, byte[] iv) throws Exception;
public abstract byte[] wrapWithSessionKey(SymmetricKey secret, SymmetricKey sessionKey, byte[] iv,
KeyWrapAlgorithm wrapAlg) throws Exception;
public abstract byte[] unwrapWithSessionKey(byte[] wrappedRecoveredKey, SymmetricKey recoveryKey,
String keyAlgorithm, byte[] nonceData) throws Exception;
public abstract byte[] unwrapWithSessionKey(byte[] wrappedRecoveredKey, SymmetricKey recoveryKey,
EncryptionAlgorithm keyAlgorithm, byte[] nonceData) throws Exception;
public abstract byte[] unwrapWithPassphrase(byte[] wrappedRecoveredKey, String recoveryPassphrase)
throws Exception;
public abstract byte[] unwrapSymmetricKeyWithSessionKey(byte[] wrappedRecoveredKey, SymmetricKey recoveryKey,
KeyWrapAlgorithm wrapAlgorithm, byte[] nonceData, String algorithm, int size)
throws Exception;
public abstract byte[] unwrapAsymmetricKeyWithSessionKey(byte[] wrappedRecoveredKey, SymmetricKey recoveryKey,
KeyWrapAlgorithm wrapAlgorithm, byte[] nonceData, PublicKey pubKey)
throws Exception;
}
|