summaryrefslogtreecommitdiffstats
path: root/base/tps/src/org/dogtagpki/server/tps/processor/CertEnrollInfo.java
blob: 9dfb3f114a8376ec21310c99d5ce3fc433f65ea3 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2013 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package org.dogtagpki.server.tps.processor;

import org.dogtagpki.server.tps.channel.SecureChannel.TokenKeyType;
import org.dogtagpki.server.tps.cms.CARenewCertResponse;
import org.dogtagpki.server.tps.cms.CARetrieveCertResponse;
import org.dogtagpki.server.tps.cms.KRARecoverKeyResponse;
import org.dogtagpki.server.tps.dbs.TokenRecord;
import org.dogtagpki.server.tps.engine.TPSEngine;

public class CertEnrollInfo {

    private TokenKeyType keyTypeEnum;
    private String profileId;
    private String certId;
    private String certAttrId;
    private String privateKeyAttrId;
    private String publicKeyAttrId;
    private String publisherId;
    private String keyType;
    private String keyTypePrefix;

    private CARetrieveCertResponse recoveredCertData;
    private KRARecoverKeyResponse  recoveredKeyData;
    private TokenRecord toBeRecoveredRecord;

    private CARenewCertResponse renewedCertData;

    private int keySize;
    private int algorithm;
    private int keyUsage;
    private int keyUser;
    private int privateKeyNumber;
    private int publicKeyNumber;
    private int startProgress;
    private int endProgress;

    private TPSEngine.ENROLL_MODES enrollmentMode = TPSEngine.ENROLL_MODES.MODE_ENROLL;

    public void setEnrollmentMode(TPSEngine.ENROLL_MODES mode) {
        enrollmentMode = mode;
    }

    public TPSEngine.ENROLL_MODES getEnrollmentMode() {
        return enrollmentMode;
    }

    public void setRecoveredCertData(CARetrieveCertResponse cData) {
        recoveredCertData = cData;
    }

    public CARetrieveCertResponse getRecoveredCertData() {
        return recoveredCertData;
    }

    public void setRecoveredKeyData(KRARecoverKeyResponse kData) {
        recoveredKeyData = kData;
    }

    public KRARecoverKeyResponse getRecoveredKeyData() {
        return recoveredKeyData;
    }


    public void setStartProgressValue(int progress) {
        startProgress = progress;
    }

    public int getStartProgressValue() {
        return startProgress;
    }

    public void setEndProgressValue(int progress) {
        endProgress = progress;
    }

    public int getEndProgressValue() {
        return endProgress;
    }

    public void setKeyTypeEnum(TokenKeyType keyTypeEnum) {
        this.keyTypeEnum = keyTypeEnum;
    }

    public TokenKeyType getKeyTypeEnum() {
        return keyTypeEnum;
    }

    public void setProfileId(String profileId) {
        this.profileId = profileId;
    }

    public String getProfileId() {
        return profileId;
    }

    public void setCertId(String certId) {
        this.certId = certId;
    }

    public String getCertId() {
        return certId;
    }

    public void setCertAttrId(String certAttrId) {
        this.certAttrId = certAttrId;
    }

    public String getCertAttrId() {
        return certAttrId;
    }

    public void setPrivateKeyAttrId(String priKeyAttrId) {
        privateKeyAttrId = priKeyAttrId;
    }

    public String getPrivateKeyAttrId() {
        return privateKeyAttrId;
    }

    public void setPublicKeyAttrId(String publicKeyAttrId) {
        this.publicKeyAttrId = publicKeyAttrId;
    }

    public String getPublicKeyAttrId() {
        return publicKeyAttrId;
    }

    public void setKeySize(int keySize) {
        this.keySize = keySize;
    }

    public int getKeySize() {
        return keySize;
    }

    public void setPublisherId(String publisherId) {
        this.publisherId = publisherId;
    }

    public String getPublisherId() {
        return publisherId;
    }

    public void setAlgorithm(int algorithm) {
        this.algorithm = algorithm;
    }

    public int getAlgorithm() {
        return algorithm;
    }

    public void setKeyUsage(int keyUsage) {
        this.keyUsage = keyUsage;
    }

    public int getKeyUsage() {
        return keyUsage;
    }

    public void setKeyUser(int keyUser) {
        this.keyUser = keyUser;
    }

    public int getKeyUser() {
        return keyUser;
    }

    public void setPrivateKeyNumber(int priKeyNumber) {
        privateKeyNumber = priKeyNumber;
    }

    public int getPrivateKeyNumber() {
        return privateKeyNumber;
    }

    public void setPublicKeyNumber(int pubKeyNumber) {
        publicKeyNumber = pubKeyNumber;
    }

    public int getPublicKeyNumber() {
        return publicKeyNumber;
    }

    public void setKeyType(String keyType) {
        this.keyType = keyType;
    }

    public String getKeyType() {
        return keyType;
    }

    public void setKeyTypePrefix(String keyTypePrefix) {
        this.keyTypePrefix = keyTypePrefix;
    }

    public String getKeyTypePrefix() {
        return keyTypePrefix;
    }

    public boolean getIsRecoveryMode() {
        if (enrollmentMode == TPSEngine.ENROLL_MODES.MODE_RECOVERY) {
            return true;
        }

        return false;
    }

    public boolean getIsRenewalMode() {
        if (enrollmentMode == TPSEngine.ENROLL_MODES.MODE_RENEWAL) {
            return true;
        }

        return false;
    }

    public boolean getIsEnrollmentMode() {
        if (enrollmentMode == TPSEngine.ENROLL_MODES.MODE_ENROLL) {
            return true;
        }

        return false;
    }

    public void setTokenToBeRecovered(TokenRecord toBeRecovered) {
        toBeRecoveredRecord = toBeRecovered;

    }

    public TokenRecord getTokenToBeRecovered() {
        return toBeRecoveredRecord;
    }

    public void setRenewedCertData(CARenewCertResponse certResponse) {
        renewedCertData = certResponse;
    }

    public CARenewCertResponse getRenewedCertData() {
        return renewedCertData;
    }

    public int getCertIdIndex() {
        int result = 0;

        if(certId != null && certId.length() == 2) {
         result = certId.charAt(1) - '0';
        }

        return result;
    }



}