root / esoecrypto / src / com / qut / middleware / crypto / CryptoProcessor.java @ 460f2a096fd9063f77651e57bf9854311aed62c4

View | Annotate | Download (2.9 KB)

1
/* 
2
 * Copyright 2006, Queensland University of Technology
3
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
4
 * use this file except in compliance with the License. You may obtain a copy of 
5
 * the License at 
6
 * 
7
 *   http://www.apache.org/licenses/LICENSE-2.0 
8
 * 
9
 * Unless required by applicable law or agreed to in writing, software 
10
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
11
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
12
 * License for the specific language governing permissions and limitations under 
13
 * the License.
14
 * 
15
 * Author: Bradley Beddoes
16
 * Creation Date: 1/5/07
17
 * 
18
 * Purpose: Handles cryptography operations, inparticular Key and Keystore generation and serialization
19
 */
20
package com.qut.middleware.crypto;
21
22
import java.security.KeyPair;
23
import java.security.KeyStore;
24
import java.security.PublicKey;
25
import java.security.cert.X509Certificate;
26
import java.security.interfaces.RSAPublicKey;
27
import java.util.Calendar;
28
29
import com.qut.middleware.crypto.exception.CryptoException;
30
import com.qut.middleware.saml2.schemas.metadata.KeyDescriptor;
31
32
public interface CryptoProcessor
33
{
34
        public String generatePassphrase();
35
36
        public KeyDescriptor createSigningKeyDescriptor(RSAPublicKey pubKey, String keyPairName, String issuerDN, String serialNumber);
37
38
        public KeyPair generateKeyPair() throws CryptoException;
39
40
        public KeyStore generateKeyStore() throws CryptoException;
41
42
        public void addPublicKey(KeyStore ks, KeyPair keyPair, String keyPairName, String keyPairSubjectDN)
43
                        throws CryptoException;
44
45
        public void addPublicKey(KeyStore ks, KeyPair keyPair, String keyPairName, String keyPairSubjectDN, Calendar before, Calendar expiry)
46
                        throws CryptoException;
47
48
        public KeyStore addKeyPair(KeyStore keyStore, String keyStorePassphrase, KeyPair keyPair, String keyPairName,
49
                        String keyPairPassphrase, String keyPairSubjectDN) throws CryptoException;
50
51
        public X509Certificate generateV3Certificate(KeyPair pair, String certSubjectDN) throws CryptoException;
52
53
        public byte[] convertKeystoreByteArray(KeyStore keyStore, String keyStorePassphrase) throws CryptoException;
54
55
        public int getCertExpiryIntervalInYears();
56
57
        public void setCertExpiryIntervalInYears(int certExpiryIntervalInYears);
58
59
        public String getCertIssuerDN();
60
61
        public void setCertIssuerDN(String certIssuerDN);
62
63
        public String getCertIssuerEmail();
64
65
        public void setCertIssuerEmail(String certIssuerEmail);
66
67
        public int getKeySize();
68
69
        public void setKeySize(int keySize);
70
71
        public KeystoreResolver getLocalResolver();
72
73
        public void setLocalResolver(KeystoreResolver localResolver);
74
        
75
        public void serializeKeyStore(KeyStore keyStore, String keyStorePassphrase, String filename) throws CryptoException;
76
        
77
        public PublicKey convertByteArrayPublicKey(byte[] rawKey) throws CryptoException;
78
        
79
        public byte[] convertPublicKeyByteArray(PublicKey key) throws CryptoException;
80
81
}