Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
793b046b
Commit
793b046b
authored
Nov 03, 2015
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-946: SSLContext must be initialized with a protocol name.
parent
f3c3d13e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
SSLConfig.java
src/java/org/jivesoftware/openfire/net/SSLConfig.java
+15
-6
No files found.
src/java/org/jivesoftware/openfire/net/SSLConfig.java
View file @
793b046b
...
...
@@ -51,8 +51,9 @@ public class SSLConfig
{
private
static
final
Logger
Log
=
LoggerFactory
.
getLogger
(
SSLConfig
.
class
);
private
final
ConcurrentMap
<
Purpose
,
String
>
l
ocationByPurpose
=
new
ConcurrentHashMap
<>();
private
final
ConcurrentMap
<
Purpose
,
String
>
identityStoreL
ocationByPurpose
=
new
ConcurrentHashMap
<>();
private
final
ConcurrentMap
<
String
,
IdentityStoreConfig
>
identityStoresByLocation
=
new
ConcurrentHashMap
<>();
private
final
ConcurrentMap
<
Purpose
,
String
>
trustStoreLocationByPurpose
=
new
ConcurrentHashMap
<>();
private
final
ConcurrentMap
<
String
,
TrustStoreConfig
>
trustStoresByLocation
=
new
ConcurrentHashMap
<>();
private
static
SSLConfig
INSTANCE
;
...
...
@@ -267,7 +268,7 @@ public class SSLConfig
{
// Instantiate an identity store.
final
String
locationIdent
=
purpose
.
getIdentityStoreLocation
();
l
ocationByPurpose
.
put
(
purpose
,
locationIdent
);
identityStoreL
ocationByPurpose
.
put
(
purpose
,
locationIdent
);
if
(
!
identityStoresByLocation
.
containsKey
(
locationIdent
)
)
{
final
IdentityStoreConfig
storeConfig
=
new
IdentityStoreConfig
(
purpose
.
getIdentityStoreLocation
(),
purpose
.
getIdentityStorePassword
(),
purpose
.
getIdentityStoreType
(),
false
);
...
...
@@ -276,7 +277,7 @@ public class SSLConfig
// Instantiate trust store.
final
String
locationTrust
=
purpose
.
getTrustStoreLocation
();
l
ocationByPurpose
.
put
(
purpose
,
locationTrust
);
trustStoreL
ocationByPurpose
.
put
(
purpose
,
locationTrust
);
if
(
!
trustStoresByLocation
.
containsKey
(
locationTrust
)
)
{
final
TrustStoreConfig
storeConfig
=
new
TrustStoreConfig
(
purpose
.
getTrustStoreLocation
(),
purpose
.
getTrustStorePassword
(),
purpose
.
getTrustStoreType
(),
false
,
purpose
.
acceptSelfSigned
(),
purpose
.
verifyValidity
()
);
...
...
@@ -290,7 +291,11 @@ public class SSLConfig
if
(
purpose
==
null
)
{
throw
new
IllegalArgumentException
(
"Argument 'purpose' cannot be null."
);
}
return
identityStoresByLocation
.
get
(
locationByPurpose
.
get
(
purpose
)
);
final
IdentityStoreConfig
config
=
identityStoresByLocation
.
get
(
identityStoreLocationByPurpose
.
get
(
purpose
)
);
if
(
config
==
null
)
{
throw
new
IllegalStateException
(
"Cannot retrieve identity store for "
+
purpose
);
}
return
config
;
}
public
TrustStoreConfig
getTrustStoreConfig
(
Purpose
purpose
)
...
...
@@ -298,7 +303,11 @@ public class SSLConfig
if
(
purpose
==
null
)
{
throw
new
IllegalArgumentException
(
"Argument 'purpose' cannot be null."
);
}
return
trustStoresByLocation
.
get
(
locationByPurpose
.
get
(
purpose
)
);
final
TrustStoreConfig
config
=
trustStoresByLocation
.
get
(
trustStoreLocationByPurpose
.
get
(
purpose
)
);
if
(
config
==
null
)
{
throw
new
IllegalStateException
(
"Cannot retrieve trust store for "
+
purpose
);
}
return
config
;
}
// public void useStoreForPurpose( Purpose purpose, String location, String password, String storeType, boolean createIfAbsent ) throws IOException, CertificateStoreConfigException
...
...
@@ -405,7 +414,7 @@ public class SSLConfig
final
KeyManager
[]
keyManagers
=
getInstance
().
getIdentityStoreConfig
(
purpose
).
getKeyManagers
();
final
TrustManager
[]
trustManagers
=
getInstance
().
getTrustStoreConfig
(
purpose
).
getTrustManagers
();
final
SSLContext
sslContext
=
SSLContext
.
getInstance
(
purpose
.
getIdentityStoreType
()
);
final
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"TLSv1"
);
sslContext
.
init
(
keyManagers
,
trustManagers
,
new
SecureRandom
()
);
return
sslContext
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment