]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.security.core/src/org/argeo/security/crypto/PBEKeySpecCallback.java
Reduce CMS size
[lgpl/argeo-commons.git] / org.argeo.security.core / src / org / argeo / security / crypto / PBEKeySpecCallback.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.security.crypto;
17
18 import javax.crypto.spec.PBEKeySpec;
19 import javax.security.auth.callback.Callback;
20 import javax.security.auth.callback.PasswordCallback;
21
22 /**
23 * All information required to set up a {@link PBEKeySpec} bar the password
24 * itself (use a {@link PasswordCallback})
25 */
26 public class PBEKeySpecCallback implements Callback {
27 private String secretKeyFactory;
28 private byte[] salt;
29 private Integer iterationCount;
30 /** Can be null for some algorithms */
31 private Integer keyLength;
32 /** Can be null, will trigger secret key encryption if not */
33 private String secretKeyEncryption;
34
35 private String encryptedPasswordHashCipher;
36 private byte[] encryptedPasswordHash;
37
38 public void set(String secretKeyFactory, byte[] salt,
39 Integer iterationCount, Integer keyLength,
40 String secretKeyEncryption) {
41 this.secretKeyFactory = secretKeyFactory;
42 this.salt = salt;
43 this.iterationCount = iterationCount;
44 this.keyLength = keyLength;
45 this.secretKeyEncryption = secretKeyEncryption;
46 // this.encryptedPasswordHashCipher = encryptedPasswordHashCipher;
47 // this.encryptedPasswordHash = encryptedPasswordHash;
48 }
49
50 public String getSecretKeyFactory() {
51 return secretKeyFactory;
52 }
53
54 public byte[] getSalt() {
55 return salt;
56 }
57
58 public Integer getIterationCount() {
59 return iterationCount;
60 }
61
62 public Integer getKeyLength() {
63 return keyLength;
64 }
65
66 public String getSecretKeyEncryption() {
67 return secretKeyEncryption;
68 }
69
70 public String getEncryptedPasswordHashCipher() {
71 return encryptedPasswordHashCipher;
72 }
73
74 public byte[] getEncryptedPasswordHash() {
75 return encryptedPasswordHash;
76 }
77
78 }