|
static String | publicKey () |
|
static String | privateKey () |
|
static byte[] | encode (ECPublicKey publicKey) |
|
static byte[] | encode (ECPrivateKey privateKey) |
|
static boolean | verifyKeyPair (PrivateKey privateKey, PublicKey publicKey) |
|
static PrivateKey | loadPrivateKey (String encodedPrivateKey) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeySpecException |
|
static PrivateKey | loadPrivateKey (byte[] decodedPrivateKey) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeySpecException |
|
static PublicKey | loadPublicKey (String encodedPublicKey) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeySpecException |
|
static PublicKey | loadPublicKey (byte[] decodedPublicKey) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeySpecException |
|
|
static final String | CURVE = "prime256v1" |
|
static final String | ALGORITHM = "ECDH" |
|
- Author
- Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Definition at line 58 of file ServerKeys.java.
◆ encode() [1/2]
static byte [] org.turro.push.security.ServerKeys.encode |
( |
ECPrivateKey |
privateKey | ) |
|
|
static |
◆ encode() [2/2]
static byte [] org.turro.push.security.ServerKeys.encode |
( |
ECPublicKey |
publicKey | ) |
|
|
static |
◆ loadPrivateKey() [1/2]
static PrivateKey org.turro.push.security.ServerKeys.loadPrivateKey |
( |
byte[] |
decodedPrivateKey | ) |
throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeySpecException |
|
static |
Definition at line 154 of file ServerKeys.java.
155 BigInteger s = BigIntegers.fromUnsignedByteArray(decodedPrivateKey);
156 ECParameterSpec parameterSpec = ECNamedCurveTable.getParameterSpec(
CURVE);
157 ECPrivateKeySpec privateKeySpec =
new ECPrivateKeySpec(s, parameterSpec);
158 KeyFactory keyFactory = KeyFactory.getInstance(
ALGORITHM, BouncyCastleProvider.PROVIDER_NAME);
160 return keyFactory.generatePrivate(privateKeySpec);
static final String CURVE
static final String ALGORITHM
◆ loadPrivateKey() [2/2]
static PrivateKey org.turro.push.security.ServerKeys.loadPrivateKey |
( |
String |
encodedPrivateKey | ) |
throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeySpecException |
|
static |
Definition at line 149 of file ServerKeys.java.
150 byte[] decodedPrivateKey = Base64.decodeBase64(encodedPrivateKey);
static PrivateKey loadPrivateKey(String encodedPrivateKey)
◆ loadPublicKey() [1/2]
static PublicKey org.turro.push.security.ServerKeys.loadPublicKey |
( |
byte[] |
decodedPublicKey | ) |
throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeySpecException |
|
static |
Definition at line 168 of file ServerKeys.java.
169 KeyFactory keyFactory = KeyFactory.getInstance(
ALGORITHM, BouncyCastleProvider.PROVIDER_NAME);
170 ECParameterSpec parameterSpec = ECNamedCurveTable.getParameterSpec(
CURVE);
171 ECCurve curve = parameterSpec.getCurve();
172 ECPoint point = curve.decodePoint(decodedPublicKey);
173 ECPublicKeySpec pubSpec =
new ECPublicKeySpec(point, parameterSpec);
175 return keyFactory.generatePublic(pubSpec);
◆ loadPublicKey() [2/2]
static PublicKey org.turro.push.security.ServerKeys.loadPublicKey |
( |
String |
encodedPublicKey | ) |
throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeySpecException |
|
static |
Definition at line 163 of file ServerKeys.java.
164 byte[] decodedPublicKey = Base64.decodeBase64(encodedPublicKey);
static PublicKey loadPublicKey(String encodedPublicKey)
◆ privateKey()
static String org.turro.push.security.ServerKeys.privateKey |
( |
| ) |
|
|
static |
Definition at line 64 of file ServerKeys.java.
65 return instance().getProperty(
"sk");
◆ publicKey()
static String org.turro.push.security.ServerKeys.publicKey |
( |
| ) |
|
|
static |
Definition at line 60 of file ServerKeys.java.
61 return instance().getProperty(
"pk");
◆ verifyKeyPair()
static boolean org.turro.push.security.ServerKeys.verifyKeyPair |
( |
PrivateKey |
privateKey, |
|
|
PublicKey |
publicKey |
|
) |
| |
|
static |
Definition at line 141 of file ServerKeys.java.
142 ECNamedCurveParameterSpec curveParameters = ECNamedCurveTable.getParameterSpec(
CURVE);
143 ECPoint g = curveParameters.getG();
144 ECPoint sG = g.multiply(((java.security.interfaces.ECPrivateKey)
privateKey).getS());
146 return sG.equals(((ECPublicKey)
publicKey).getQ());
◆ ALGORITHM
final String org.turro.push.security.ServerKeys.ALGORITHM = "ECDH" |
|
static |
◆ CURVE
final String org.turro.push.security.ServerKeys.CURVE = "prime256v1" |
|
static |
The documentation for this class was generated from the following file: