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
26b1437b
Commit
26b1437b
authored
Dec 07, 2015
by
Dave Cridland
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #434 from tevans/master
Avoid using classes from sealed packages
parents
c5144fa6
5803bde4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
KeystoreTestUtils.java
...org/jivesoftware/openfire/keystore/KeystoreTestUtils.java
+24
-12
No files found.
src/test/java/org/jivesoftware/openfire/keystore/KeystoreTestUtils.java
View file @
26b1437b
package
org
.
jivesoftware
.
openfire
.
keystore
;
import
java.math.BigInteger
;
import
java.security.KeyPair
;
import
java.security.KeyPairGenerator
;
import
java.security.Provider
;
import
java.security.SecureRandom
;
import
java.security.Security
;
import
java.security.cert.CertPathBuilder
;
import
java.security.cert.CertPathBuilderResult
;
import
java.security.cert.CertStore
;
import
java.security.cert.CollectionCertStoreParameters
;
import
java.security.cert.PKIXBuilderParameters
;
import
java.security.cert.PKIXCertPathBuilderResult
;
import
java.security.cert.TrustAnchor
;
import
java.security.cert.X509CertSelector
;
import
java.security.cert.X509Certificate
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.bouncycastle.asn1.x500.X500Name
;
import
org.bouncycastle.asn1.x509.BasicConstraints
;
import
org.bouncycastle.asn1.x509.Extension
;
...
...
@@ -10,16 +29,7 @@ import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.bouncycastle.operator.ContentSigner
;
import
org.bouncycastle.operator.jcajce.JcaContentSignerBuilder
;
import
org.jivesoftware.util.Base64
;
import
sun.security.provider.X509Factory
;
import
java.math.BigInteger
;
import
java.security.*
;
import
java.security.cert.*
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Set
;
/**
* Utility functions that are intended to be used by unit tests.
...
...
@@ -29,7 +39,9 @@ import java.util.Set;
public
class
KeystoreTestUtils
{
private
static
final
Provider
PROVIDER
=
new
BouncyCastleProvider
();
private
static
final
Object
BEGIN_CERT
=
"-----BEGIN CERTIFICATE-----"
;
private
static
final
Object
END_CERT
=
"-----END CERTIFICATE-----"
;
static
{
// Add the BC provider to the list of security providers
...
...
@@ -44,9 +56,9 @@ public class KeystoreTestUtils
*/
public
static
String
toPemFormat
(
X509Certificate
certificate
)
throws
Exception
{
final
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
X509Factory
.
BEGIN_CERT
).
append
(
'\n'
);
sb
.
append
(
BEGIN_CERT
).
append
(
'\n'
);
sb
.
append
(
Base64
.
encodeBytes
(
certificate
.
getEncoded
()
)
).
append
(
'\n'
);
sb
.
append
(
X509Factory
.
END_CERT
).
append
(
'\n'
);
sb
.
append
(
END_CERT
).
append
(
'\n'
);
return
sb
.
toString
();
}
...
...
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