2 * Copyright (C) 2007-2012 Argeo GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.node
.security
;
18 import javax
.crypto
.spec
.PBEKeySpec
;
19 import javax
.security
.auth
.callback
.Callback
;
20 import javax
.security
.auth
.callback
.PasswordCallback
;
23 * All information required to set up a {@link PBEKeySpec} bar the password
24 * itself (use a {@link PasswordCallback})
26 public class PBEKeySpecCallback
implements Callback
{
27 private String secretKeyFactory
;
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
;
35 private String encryptedPasswordHashCipher
;
36 private byte[] encryptedPasswordHash
;
38 public void set(String secretKeyFactory
, byte[] salt
,
39 Integer iterationCount
, Integer keyLength
,
40 String secretKeyEncryption
) {
41 this.secretKeyFactory
= secretKeyFactory
;
43 this.iterationCount
= iterationCount
;
44 this.keyLength
= keyLength
;
45 this.secretKeyEncryption
= secretKeyEncryption
;
46 // this.encryptedPasswordHashCipher = encryptedPasswordHashCipher;
47 // this.encryptedPasswordHash = encryptedPasswordHash;
50 public String
getSecretKeyFactory() {
51 return secretKeyFactory
;
54 public byte[] getSalt() {
58 public Integer
getIterationCount() {
59 return iterationCount
;
62 public Integer
getKeyLength() {
66 public String
getSecretKeyEncryption() {
67 return secretKeyEncryption
;
70 public String
getEncryptedPasswordHashCipher() {
71 return encryptedPasswordHashCipher
;
74 public byte[] getEncryptedPasswordHash() {
75 return encryptedPasswordHash
;