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
a430419a
Commit
a430419a
authored
Jan 17, 2016
by
André Berenguel
Committed by
Guus der Kinderen
Jan 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify isSelfSignedCertificate method
parent
399ea817
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
CertificateManager.java
src/java/org/jivesoftware/util/CertificateManager.java
+4
-10
No files found.
src/java/org/jivesoftware/util/CertificateManager.java
View file @
a430419a
...
@@ -44,7 +44,6 @@ import java.security.cert.CertPathValidator;
...
@@ -44,7 +44,6 @@ import java.security.cert.CertPathValidator;
import
java.security.cert.CertPathValidatorException
;
import
java.security.cert.CertPathValidatorException
;
import
java.security.cert.CertStore
;
import
java.security.cert.CertStore
;
import
java.security.cert.Certificate
;
import
java.security.cert.Certificate
;
import
java.security.cert.CertificateEncodingException
;
import
java.security.cert.CertificateException
;
import
java.security.cert.CertificateException
;
import
java.security.cert.CertificateFactory
;
import
java.security.cert.CertificateFactory
;
import
java.security.cert.CollectionCertStoreParameters
;
import
java.security.cert.CollectionCertStoreParameters
;
...
@@ -81,7 +80,6 @@ import org.bouncycastle.asn1.x509.GeneralNames;
...
@@ -81,7 +80,6 @@ import org.bouncycastle.asn1.x509.GeneralNames;
import
org.bouncycastle.cert.CertException
;
import
org.bouncycastle.cert.CertException
;
import
org.bouncycastle.cert.X509CertificateHolder
;
import
org.bouncycastle.cert.X509CertificateHolder
;
import
org.bouncycastle.cert.jcajce.JcaX509CertificateConverter
;
import
org.bouncycastle.cert.jcajce.JcaX509CertificateConverter
;
import
org.bouncycastle.cert.jcajce.JcaX509CertificateHolder
;
import
org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils
;
import
org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils
;
import
org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder
;
import
org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder
;
import
org.bouncycastle.openssl.MiscPEMGenerator
;
import
org.bouncycastle.openssl.MiscPEMGenerator
;
...
@@ -425,15 +423,11 @@ public class CertificateManager {
...
@@ -425,15 +423,11 @@ public class CertificateManager {
* @throws KeyStoreException if an error happens while usign the keystore
* @throws KeyStoreException if an error happens while usign the keystore
*/
*/
public
static
boolean
isSelfSignedCertificate
(
X509Certificate
certificate
)
throws
KeyStoreException
{
public
static
boolean
isSelfSignedCertificate
(
X509Certificate
certificate
)
throws
KeyStoreException
{
try
{
try
{
JcaX509CertificateHolder
certificateHolder
=
new
JcaX509CertificateHolder
(
certificate
);
certificate
.
verify
(
certificate
.
getPublicKey
());
ContentVerifierProvider
verifier
=
new
JcaContentVerifierProviderBuilder
().
setProvider
(
"BC"
).
build
(
return
true
;
certificate
.
getPublicKey
());
}
catch
(
GeneralSecurityException
e
)
{
return
false
;
return
certificateHolder
.
isSignatureValid
(
verifier
);
}
catch
(
CertException
|
CertificateEncodingException
|
OperatorCreationException
e
)
{
return
certificate
.
getSubjectDN
().
equals
(
certificate
.
getIssuerDN
());
}
}
}
}
...
...
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