public class Utils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ALGORITHM |
static java.lang.String |
CURVE |
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
combinedLength(byte[]... arrays)
Compute combined array length
|
static byte[] |
concat(byte[]... arrays)
Utility to concat byte arrays
|
static byte[] |
encode(org.bouncycastle.jce.interfaces.ECPrivateKey privateKey) |
static byte[] |
encode(org.bouncycastle.jce.interfaces.ECPublicKey publicKey)
Get the uncompressed encoding of the public key point.
|
static java.security.PrivateKey |
loadPrivateKey(java.lang.String encodedPrivateKey)
Load the private key from a URL-safe base64 encoded string
|
static org.bouncycastle.jce.interfaces.ECPublicKey |
loadPublicKey(org.bouncycastle.jce.interfaces.ECPrivateKey privateKey)
Load a public key from the private key.
|
static java.security.PublicKey |
loadPublicKey(java.lang.String encodedPublicKey)
Load the public key from a URL-safe base64 encoded string.
|
static byte[] |
toByteArray(int integer,
int size)
Create a byte array of the given length from the given integer.
|
static boolean |
verifyKeyPair(java.security.PrivateKey privateKey,
java.security.PublicKey publicKey)
Verify that the private key belongs to the public key.
|
public static final java.lang.String CURVE
public static final java.lang.String ALGORITHM
public static byte[] encode(org.bouncycastle.jce.interfaces.ECPublicKey publicKey)
publicKey - public static byte[] encode(org.bouncycastle.jce.interfaces.ECPrivateKey privateKey)
public static java.security.PublicKey loadPublicKey(java.lang.String encodedPublicKey)
throws java.security.NoSuchProviderException,
java.security.NoSuchAlgorithmException,
java.security.spec.InvalidKeySpecException
encodedPublicKey - java.security.NoSuchProviderExceptionjava.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecExceptionpublic static java.security.PrivateKey loadPrivateKey(java.lang.String encodedPrivateKey)
throws java.security.NoSuchProviderException,
java.security.NoSuchAlgorithmException,
java.security.spec.InvalidKeySpecException
encodedPrivateKey - java.security.NoSuchProviderExceptionjava.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecExceptionpublic static org.bouncycastle.jce.interfaces.ECPublicKey loadPublicKey(org.bouncycastle.jce.interfaces.ECPrivateKey privateKey)
throws java.security.NoSuchProviderException,
java.security.NoSuchAlgorithmException,
java.security.spec.InvalidKeySpecException
privateKey - java.security.NoSuchProviderExceptionjava.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecExceptionpublic static boolean verifyKeyPair(java.security.PrivateKey privateKey,
java.security.PublicKey publicKey)
privateKey - publicKey - public static byte[] concat(byte[]... arrays)
public static int combinedLength(byte[]... arrays)
public static byte[] toByteArray(int integer,
int size)
integer - size -