summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/util/CryptoProvider.java
blob: d0c753ae0d57e9bf8c229486db2745b10e970600 (plain)
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
package com.netscape.certsrv.util;

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 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(SymmetricKey secret, SymmetricKey sessionKey, byte[] iv) throws Exception;

    public abstract byte[] unwrapWithSessionKey(byte[] wrappedRecoveredKey, SymmetricKey recoveryKey,
            String keyAlgorithm, byte[] nonceData) throws Exception;

    public abstract byte[] unwrapWithPassphrase(byte[] wrappedRecoveredKey, String recoveryPassphrase)
            throws Exception;

    public abstract byte[] createPKIArchiveOptions(String transportCert, SymmetricKey secret, String passphrase,
            String keyAlgorithm, int symKeySize, byte[] nonceData) throws Exception;

}