View Javadoc
1   /*
2    * GordianKnot: Security Suite
3    * Copyright 2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  
18  package io.github.tonywasher.joceanus.gordianknot.api.cipher.spec;
19  
20  import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianPBESpec.GordianPBEArgon2Spec;
21  import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianPBESpec.GordianPBEDigestAndCountSpec;
22  import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianPBESpec.GordianPBESCryptSpec;
23  import io.github.tonywasher.joceanus.gordianknot.api.digest.spec.GordianDigestSpec;
24  import io.github.tonywasher.joceanus.gordianknot.api.digest.spec.GordianDigestSpecBuilder;
25  
26  /**
27   * PBE Specification Builder.
28   */
29  public interface GordianPBESpecBuilder {
30      /**
31       * Access digestSpecBuilder.
32       *
33       * @return the digestSpec builder
34       */
35      GordianDigestSpecBuilder usingDigestSpecBuilder();
36  
37      /**
38       * Create a pbkdf2Spec.
39       *
40       * @param pDigestSpec the digestSpec.
41       * @param pCount      the iteration count
42       * @return the new spec
43       */
44      GordianPBEDigestAndCountSpec pbKDF2(GordianDigestSpec pDigestSpec,
45                                          int pCount);
46  
47      /**
48       * Create a pkcs12Spec.
49       *
50       * @param pDigestSpec the digestSpec.
51       * @param pCount      the iteration count
52       * @return the new spec
53       */
54      GordianPBEDigestAndCountSpec pkcs12(GordianDigestSpec pDigestSpec,
55                                          int pCount);
56  
57      /**
58       * Create a scryptSpec.
59       *
60       * @param pCost      the cost
61       * @param pBlockSize the blockSize
62       * @param pParallel  the parallelisation
63       * @return the new spec
64       */
65      GordianPBESCryptSpec scrypt(int pCost,
66                                  int pBlockSize,
67                                  int pParallel);
68  
69      /**
70       * Create an argonSpec.
71       *
72       * @param pLanes      the Lanes
73       * @param pMemory     the Memory
74       * @param pIterations the iterations
75       * @return the new spec
76       */
77      GordianPBEArgon2Spec argon2(int pLanes,
78                                  int pMemory,
79                                  int pIterations);
80  }