This repository was archived by the owner on Mar 6, 2020. It is now read-only.
forked from bcgit/bc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
157 additions
and
2,029 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tls/src/main/java/org/bouncycastle/tls/crypto/impl/bc/Exceptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.bouncycastle.tls.crypto.impl.bc; | ||
|
||
/** | ||
* In earlier JDK's these do not allow nested exceptions | ||
*/ | ||
class Exceptions | ||
{ | ||
static IllegalArgumentException illegalArgumentException(String message, Throwable cause) | ||
{ | ||
return new IllegalArgumentException(message, cause); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
tls/src/main/java/org/bouncycastle/tls/crypto/impl/jcajce/ECUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.bouncycastle.tls.crypto.impl.jcajce; | ||
|
||
import java.security.AlgorithmParameters; | ||
import java.security.PrivateKey; | ||
import java.security.interfaces.ECPrivateKey; | ||
import java.security.spec.ECGenParameterSpec; | ||
import java.security.spec.ECParameterSpec; | ||
|
||
import org.bouncycastle.jcajce.util.JcaJceHelper; | ||
|
||
class ECUtil | ||
{ | ||
static boolean isECPrivateKey(PrivateKey key) | ||
{ | ||
return key instanceof ECPrivateKey || "EC".equals(key.getAlgorithm()); | ||
} | ||
|
||
static boolean isCurveSupported(String curveName, JcaJceHelper helper) | ||
{ | ||
try | ||
{ | ||
AlgorithmParameters params = helper.createAlgorithmParameters("EC"); | ||
params.init(new ECGenParameterSpec(curveName)); | ||
if (params.getParameterSpec(ECParameterSpec.class) != null) | ||
{ | ||
return true; | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
} | ||
|
||
return false; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tls/src/main/java/org/bouncycastle/tls/crypto/impl/jcajce/Exceptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.bouncycastle.tls.crypto.impl.jcajce; | ||
|
||
/** | ||
* In earlier JDK's these do not allow nested exceptions | ||
*/ | ||
class Exceptions | ||
{ | ||
static IllegalStateException illegalStateException(String message, Throwable cause) | ||
{ | ||
return new IllegalStateException(message, cause); | ||
} | ||
|
||
static IllegalArgumentException illegalArgumentException(String message, Throwable cause) | ||
{ | ||
return new IllegalArgumentException(message, cause); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.