View Javadoc
1   package org.kuali.common.jute.enc.openssl;
2   
3   import static org.kuali.common.jute.reflect.Reflection.checkNoNulls;
4   
5   public final class OpenSSLSaltContext {
6   
7       private final String prefix;
8       private final int bytes;
9       private final boolean secure;
10  
11      private OpenSSLSaltContext(Builder builder) {
12          this.prefix = builder.prefix;
13          this.bytes = builder.bytes;
14          this.secure = builder.secure;
15      }
16  
17      public static OpenSSLSaltContext build() {
18          return builder().build();
19      }
20  
21      public static Builder builder() {
22          return new Builder();
23      }
24  
25      public static class Builder implements org.apache.commons.lang3.builder.Builder<OpenSSLSaltContext> {
26  
27          private String prefix = "Salted__";
28          private int bytes = 8;
29          private boolean secure = true;
30  
31          public Builder withPrefix(String prefix) {
32              this.prefix = prefix;
33              return this;
34          }
35  
36          public Builder withBytes(int bytes) {
37              this.bytes = bytes;
38              return this;
39          }
40  
41          public Builder withSecure(boolean secure) {
42              this.secure = secure;
43              return this;
44          }
45  
46          @Override
47          public OpenSSLSaltContext build() {
48              return checkNoNulls(new OpenSSLSaltContext(this));
49          }
50  
51          public String getPrefix() {
52              return prefix;
53          }
54  
55          public void setPrefix(String prefix) {
56              this.prefix = prefix;
57          }
58  
59          public int getBytes() {
60              return bytes;
61          }
62  
63          public void setBytes(int bytes) {
64              this.bytes = bytes;
65          }
66  
67          public boolean isSecure() {
68              return secure;
69          }
70  
71          public void setSecure(boolean secure) {
72              this.secure = secure;
73          }
74      }
75  
76      public String getPrefix() {
77          return prefix;
78      }
79  
80      public int getBytes() {
81          return bytes;
82      }
83  
84      public boolean isSecure() {
85          return secure;
86      }
87  
88  }