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
a1cf99e0
Commit
a1cf99e0
authored
Dec 15, 2015
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-1004: Add functionality to determine supported encryption protocols/suites.
parent
5c87f318
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
EncryptionArtifactFactory.java
.../jivesoftware/openfire/spi/EncryptionArtifactFactory.java
+26
-0
EncryptionArtifactFactoryTest.java
...esoftware/openfire/spi/EncryptionArtifactFactoryTest.java
+44
-0
No files found.
src/java/org/jivesoftware/openfire/spi/EncryptionArtifactFactory.java
View file @
a1cf99e0
...
...
@@ -325,4 +325,30 @@ public class EncryptionArtifactFactory
}
return
filter
;
}
/**
* Returns the names of all encryption protocols that are supported (but not necessarily enabled).
*
* @return An array of protocol names. Not expected to be empty.
*/
public
static
String
[]
getSupportedProtocols
()
throws
NoSuchAlgorithmException
,
KeyManagementException
{
// TODO Might want to cache the result. It's unlikely to change at runtime.
final
SSLContext
context
=
SSLContext
.
getInstance
(
"TLSv1"
);
context
.
init
(
null
,
null
,
null
);
return
context
.
createSSLEngine
().
getSupportedProtocols
();
}
/**
* Returns the names of all encryption cipher suites that are supported (but not necessarily enabled).
*
* @return An array of cipher suite names. Not expected to be empty.
*/
public
static
String
[]
getSupportedCipherSuites
()
throws
NoSuchAlgorithmException
,
KeyManagementException
{
// TODO Might want to cache the result. It's unlikely to change at runtime.
final
SSLContext
context
=
SSLContext
.
getInstance
(
"TLSv1"
);
context
.
init
(
null
,
null
,
null
);
return
context
.
createSSLEngine
().
getSupportedCipherSuites
();
}
}
src/test/java/org/jivesoftware/openfire/spi/EncryptionArtifactFactoryTest.java
0 → 100644
View file @
a1cf99e0
package
org
.
jivesoftware
.
openfire
.
spi
;
import
org.junit.Assert
;
import
org.junit.Test
;
/**
* Unit tests that verify the functionality of {@link EncryptionArtifactFactory}.
*
* @author Guus der Kinderen, guus.der.kinderen@gmail.com
*/
public
class
EncryptionArtifactFactoryTest
{
/**
* Verifies that the collection of supported encryption protocols is not empty.
*/
@Test
public
void
testHasSupportedProtocols
()
throws
Exception
{
// Setup fixture.
// (not needed)
// Execute system under test.
final
String
[]
result
=
EncryptionArtifactFactory
.
getSupportedProtocols
();
// Verify results.
Assert
.
assertTrue
(
result
.
length
>
0
);
}
/**
* Verifies that the collection of supported cipher suites is not empty.
*/
@Test
public
void
testHasSupportedCipherSuites
()
throws
Exception
{
// Setup fixture.
// (not needed)
// Execute system under test.
final
String
[]
result
=
EncryptionArtifactFactory
.
getSupportedCipherSuites
();
// Verify results.
Assert
.
assertTrue
(
result
.
length
>
0
);
}
}
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