public abstract class MessageCryptex extends Object
| Constructor and Description |
|---|
MessageCryptex() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
bytesAreValid(PublicKey certificate,
byte[] bytes,
byte[] signature)
This method checks to see if the signature for a signed byte array is valid.
|
abstract PrivateKey |
decodePrivateKey(String pem,
char[] password)
This method decodes private key from a PEM string.
|
abstract PublicKey |
decodePublicKey(String pem)
This method decodes public key from a PEM string.
|
byte[] |
decodeString(String base64String)
This method decodes a base 64 string into its original bytes.
|
abstract CipherInputStream |
decryptionInputStream(SecretKey sharedKey,
InputStream input)
This method generates an input stream that performs decryption on another input stream.
|
abstract SecretKey |
decryptSharedKey(PrivateKey privateKey,
byte[] encryptedKey)
This method decrypts a shared key using the private key that is paired with the public certificate that was
used to encrypt it at the source.
|
void |
decryptStream(SecretKey sharedKey,
InputStream input,
OutputStream output)
This method decrypts a byte stream from an encrypted byte stream.
|
String |
decryptString(SecretKey sharedKey,
byte[] encryptedString)
This method decrypts a string using a shared key.
|
String |
encodeBytes(byte[] bytes)
This method encodes a byte array into a base 64 string.
|
abstract String |
encodePrivateKey(PrivateKey key,
char[] password)
This method encodes a private key into a PEM string.
|
abstract String |
encodePublicKey(PublicKey key)
This method encodes a public key into a PEM string.
|
abstract CipherOutputStream |
encryptionOutputStream(SecretKey sharedKey,
OutputStream output)
This method generates an output stream that performs encryption on another output stream.
|
abstract byte[] |
encryptSharedKey(PublicKey certificate,
SecretKey sharedKey)
This method encrypts a shared key using the public certificate of the destination for a data stream that will
be encrypted using the shared key.
|
void |
encryptStream(SecretKey sharedKey,
InputStream input,
OutputStream output)
This method encrypts a byte stream using a shared key.
|
byte[] |
encryptString(SecretKey sharedKey,
String string)
This method encrypts a string using a shared key.
|
abstract KeyPair |
generateKeyPair()
This method generates a new public/private key pair.
|
abstract SecretKey |
generateSharedKey()
This method generates a shared (secret) key to be used for encrypting
large amounts of data.
|
abstract String |
getAsymmetricEncryptionAlgorithm()
This method returns the asymmetric encryption algorithm used by this cryptex.
|
abstract int |
getAsymmetricKeySize()
This method returns the asymmetric key size.
|
abstract String |
getAsymmetricKeyType()
This method returns the asymmetric key type string.
|
abstract String |
getAsymmetricSignatureAlgorithm()
This method returns the asymmetric signature algorithm used by this cryptex.
|
abstract String |
getHashAlgorithm()
This method returns the hash algorithm.
|
abstract String |
getPasswordEncodingType()
This method returns the password encoding type used for password based encryption (PBE)
used by this cryptex.
|
abstract String |
getSymmetricEncryptionAlgorithm()
This method returns the symmetric encryption algorithm used by this cryptex.
|
abstract int |
getSymmetricKeySize()
This method returns the symmetric key size used by this cryptex.
|
abstract String |
getSymmetricKeyType()
This method returns the symmetric key type used by this cryptex.
|
abstract String |
hashString(String string)
This method returns a base 64 encoded SHA256 one-way hash of the specified string.
|
abstract byte[] |
signBytes(PrivateKey privateKey,
byte[] bytes)
This method signs a byte array.
|
public final String encodeBytes(byte[] bytes)
bytes - The byte array to be encoded.public final byte[] decodeString(String base64String)
base64String - The base 64 encoded string.public abstract String getHashAlgorithm()
public abstract String hashString(String string)
string - The string to be hashed.public abstract String getPasswordEncodingType()
public abstract String getSymmetricKeyType()
public abstract int getSymmetricKeySize()
public abstract String getSymmetricEncryptionAlgorithm()
public abstract SecretKey generateSharedKey()
public final byte[] encryptString(SecretKey sharedKey, String string)
sharedKey - The shared key used for the encryption.string - The string to be encrypted.public final String decryptString(SecretKey sharedKey, byte[] encryptedString)
sharedKey - The shared key used for the encryption.encryptedString - The encrypted string.public final void encryptStream(SecretKey sharedKey, InputStream input, OutputStream output) throws IOException
sharedKey - The shared key used for the encryption.input - The byte stream to be encrypted.output - The encrypted output stream.IOException - Unable to encrypt the stream.public final void decryptStream(SecretKey sharedKey, InputStream input, OutputStream output) throws IOException
sharedKey - The shared key used for the encryption.input - The encrypted byte stream.output - The decrypted byte stream.IOException - Unable to decrypt the stream.public abstract CipherOutputStream encryptionOutputStream(SecretKey sharedKey, OutputStream output) throws IOException
sharedKey - The shared key used for the encryption.output - The output stream to be encrypted.IOException - Unable to create an encryption output stream.public abstract CipherInputStream decryptionInputStream(SecretKey sharedKey, InputStream input) throws IOException
sharedKey - The shared key used for the encryption.input - The input stream to be decrypted.IOException - Unable to create a decryption input stream.public abstract String getAsymmetricKeyType()
public abstract int getAsymmetricKeySize()
public abstract String getAsymmetricSignatureAlgorithm()
public abstract String getAsymmetricEncryptionAlgorithm()
public abstract KeyPair generateKeyPair()
public abstract String encodePublicKey(PublicKey key)
key - The public key.public abstract PublicKey decodePublicKey(String pem)
pem - The PEM string for the public key.public abstract String encodePrivateKey(PrivateKey key, char[] password)
key - The private key.password - The password to be used to encrypt the private key.public abstract PrivateKey decodePrivateKey(String pem, char[] password)
pem - The PEM string for the private key.password - The password to be used to decrypt the private key.public abstract byte[] signBytes(PrivateKey privateKey, byte[] bytes)
privateKey - The private key used for signing.bytes - The byte array to be signed.public abstract boolean bytesAreValid(PublicKey certificate, byte[] bytes, byte[] signature)
certificate - The certificate containing the matching public key for the private key that signed the bytes.bytes - The byte array to be signed.signature - The signature to be validated.public abstract byte[] encryptSharedKey(PublicKey certificate, SecretKey sharedKey)
certificate - The public certificate of the destination.sharedKey - The shared key to be encrypted.public abstract SecretKey decryptSharedKey(PrivateKey privateKey, byte[] encryptedKey)
privateKey - The private key of the destination.encryptedKey - The encrypted shared key.Copyright © 2016 Crater Dog Technologies(TM). All rights reserved.