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
25c09adb
Commit
25c09adb
authored
Oct 22, 2015
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-946: Setting Provider explicitly to pass unit est.
parent
4ca263d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
15 deletions
+16
-15
CertificateStoreConfig.java
...ivesoftware/openfire/keystore/CertificateStoreConfig.java
+10
-3
IdentityStoreConfig.java
...g/jivesoftware/openfire/keystore/IdentityStoreConfig.java
+1
-9
TrustStoreConfig.java
.../org/jivesoftware/openfire/keystore/TrustStoreConfig.java
+4
-2
TrustStoreConfigTest.java
.../jivesoftware/openfire/keystore/TrustStoreConfigTest.java
+1
-1
No files found.
src/java/org/jivesoftware/openfire/keystore/CertificateStoreConfig.java
View file @
25c09adb
package
org
.
jivesoftware
.
openfire
.
keystore
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.jivesoftware.openfire.net.SSLConfig
;
import
org.jivesoftware.util.CertificateEventListener
;
import
org.jivesoftware.util.JiveGlobals
;
...
...
@@ -12,9 +13,7 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.security.KeyStore
;
import
java.security.KeyStoreException
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.*
;
import
java.security.cert.Certificate
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
...
...
@@ -39,6 +38,14 @@ public abstract class CertificateStoreConfig
{
private
static
final
Logger
Log
=
LoggerFactory
.
getLogger
(
CertificateStoreConfig
.
class
);
protected
static
final
Provider
PROVIDER
=
new
BouncyCastleProvider
();
static
{
// Add the BC provider to the list of security providers
Security
.
addProvider
(
PROVIDER
);
}
protected
final
KeyStore
store
;
protected
final
char
[]
password
;
protected
final
String
canonicalPath
;
...
...
src/java/org/jivesoftware/openfire/keystore/IdentityStoreConfig.java
View file @
25c09adb
...
...
@@ -41,14 +41,6 @@ public class IdentityStoreConfig extends CertificateStoreConfig
{
private
static
final
Logger
Log
=
LoggerFactory
.
getLogger
(
IdentityStoreConfig
.
class
);
private
static
final
Provider
PROVIDER
=
new
BouncyCastleProvider
();
static
{
// Add the BC provider to the list of security providers
Security
.
addProvider
(
PROVIDER
);
}
protected
final
KeyManagerFactory
keyFactory
;
public
IdentityStoreConfig
(
String
path
,
String
password
,
String
type
,
boolean
createIfAbsent
)
throws
CertificateStoreConfigException
...
...
@@ -57,7 +49,7 @@ public class IdentityStoreConfig extends CertificateStoreConfig
try
{
keyFactory
=
KeyManagerFactory
.
getInstance
(
KeyManagerFactory
.
getDefaultAlgorithm
()
);
keyFactory
=
KeyManagerFactory
.
getInstance
(
KeyManagerFactory
.
getDefaultAlgorithm
()
,
PROVIDER
);
keyFactory
.
init
(
store
,
password
.
toCharArray
()
);
}
catch
(
UnrecoverableKeyException
|
NoSuchAlgorithmException
|
KeyStoreException
ex
)
...
...
src/java/org/jivesoftware/openfire/keystore/TrustStoreConfig.java
View file @
25c09adb
package
org
.
jivesoftware
.
openfire
.
keystore
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.jivesoftware.util.CertificateManager
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -9,6 +10,7 @@ import javax.net.ssl.TrustManagerFactory;
import
java.io.IOException
;
import
java.security.KeyStoreException
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.Provider
;
import
java.security.cert.*
;
import
java.util.*
;
...
...
@@ -36,8 +38,8 @@ public class TrustStoreConfig extends CertificateStoreConfig
try
{
certPathValidator
=
CertPathValidator
.
getInstance
(
"PKIX"
);
certificateFactory
=
CertificateFactory
.
getInstance
(
"X.509"
);
certPathValidator
=
CertPathValidator
.
getInstance
(
"PKIX"
,
PROVIDER
);
certificateFactory
=
CertificateFactory
.
getInstance
(
"X.509"
,
PROVIDER
);
trustFactory
=
TrustManagerFactory
.
getInstance
(
TrustManagerFactory
.
getDefaultAlgorithm
()
);
trustFactory
.
init
(
store
);
}
...
...
src/test/java/org/jivesoftware/openfire/keystore/TrustStoreConfigTest.java
View file @
25c09adb
...
...
@@ -122,7 +122,7 @@ public class TrustStoreConfigTest
// Setup fixture.
// Execute system under test.
final
Set
<
X509Certificate
>
result
=
trustStoreConfig
.
getAllCertificates
();
final
Map
<
String
,
X509Certificate
>
result
=
trustStoreConfig
.
getAllCertificates
();
// Verify results.
Assert
.
assertEquals
(
2
,
result
.
size
()
);
...
...
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