equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
54 } |
54 } |
55 } |
55 } |
56 |
56 |
57 public static final int DEF_DSA_KEY_SIZE; |
57 public static final int DEF_DSA_KEY_SIZE; |
58 public static final int DEF_RSA_KEY_SIZE; |
58 public static final int DEF_RSA_KEY_SIZE; |
|
59 public static final int DEF_RSASSA_PSS_KEY_SIZE; |
59 public static final int DEF_DH_KEY_SIZE; |
60 public static final int DEF_DH_KEY_SIZE; |
60 public static final int DEF_EC_KEY_SIZE; |
61 public static final int DEF_EC_KEY_SIZE; |
61 |
62 |
62 private static final String KEY_LENGTH_PROP = |
63 private static final String KEY_LENGTH_PROP = |
63 "jdk.security.defaultKeySize"; |
64 "jdk.security.defaultKeySize"; |
64 static { |
65 static { |
65 String keyLengthStr = GetPropertyAction.privilegedGetProperty |
66 String keyLengthStr = GetPropertyAction.privilegedGetProperty |
66 (KEY_LENGTH_PROP); |
67 (KEY_LENGTH_PROP); |
67 int dsaKeySize = 2048; |
68 int dsaKeySize = 2048; |
68 int rsaKeySize = 2048; |
69 int rsaKeySize = 2048; |
|
70 int rsaSsaPssKeySize = rsaKeySize; // default to same value as RSA |
69 int dhKeySize = 2048; |
71 int dhKeySize = 2048; |
70 int ecKeySize = 256; |
72 int ecKeySize = 256; |
71 |
73 |
72 if (keyLengthStr != null) { |
74 if (keyLengthStr != null) { |
73 try { |
75 try { |
96 } |
98 } |
97 if (algoName.equals("DSA")) { |
99 if (algoName.equals("DSA")) { |
98 dsaKeySize = value; |
100 dsaKeySize = value; |
99 } else if (algoName.equals("RSA")) { |
101 } else if (algoName.equals("RSA")) { |
100 rsaKeySize = value; |
102 rsaKeySize = value; |
|
103 } else if (algoName.equals("RSASSA-PSS")) { |
|
104 rsaSsaPssKeySize = value; |
101 } else if (algoName.equals("DH")) { |
105 } else if (algoName.equals("DH")) { |
102 dhKeySize = value; |
106 dhKeySize = value; |
103 } else if (algoName.equals("EC")) { |
107 } else if (algoName.equals("EC")) { |
104 ecKeySize = value; |
108 ecKeySize = value; |
105 } else { |
109 } else { |
123 } |
127 } |
124 } |
128 } |
125 } |
129 } |
126 DEF_DSA_KEY_SIZE = dsaKeySize; |
130 DEF_DSA_KEY_SIZE = dsaKeySize; |
127 DEF_RSA_KEY_SIZE = rsaKeySize; |
131 DEF_RSA_KEY_SIZE = rsaKeySize; |
|
132 DEF_RSASSA_PSS_KEY_SIZE = rsaSsaPssKeySize; |
128 DEF_DH_KEY_SIZE = dhKeySize; |
133 DEF_DH_KEY_SIZE = dhKeySize; |
129 DEF_EC_KEY_SIZE = ecKeySize; |
134 DEF_EC_KEY_SIZE = ecKeySize; |
130 } |
135 } |
131 } |
136 } |