public class Crypto
extends java.lang.Object
Constructor and Description |
---|
Crypto(net.maidsafe.api.AppHandle handle)
Initialises the Crypto object
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<byte[]> |
decrypt(NativeHandle senderPublicEncryptKey,
NativeHandle recipientSecretEncryptKey,
byte[] cipherText)
Decrypts encrypted data using sender's public encryption key and recipient's private encryption key
|
java.util.concurrent.CompletableFuture<byte[]> |
decryptSealedBox(NativeHandle recipientPublicEncryptKey,
NativeHandle recipientSecretEncryptKey,
byte[] cipherText)
Decrypts content encrypted by sealed box encryption
|
java.util.concurrent.CompletableFuture<byte[]> |
encrypt(NativeHandle recipientPublicEncryptKey,
NativeHandle senderSecretEncryptKey,
byte[] data)
Encrypts data with the sender's public encryption key and recipient's private encryption key
|
java.util.concurrent.CompletableFuture<byte[]> |
encryptSealedBox(NativeHandle recipientPublicEncryptKey,
byte[] data)
Encrypts data using private and public encryption keys with a seal
|
java.util.concurrent.CompletableFuture<EncryptKeyPair> |
generateEncryptKeyPair()
Generate a new encryption key pair
|
static java.util.concurrent.CompletableFuture<byte[]> |
generateNonce()
Generates a unique nonce
|
java.util.concurrent.CompletableFuture<SignKeyPair> |
generateSignKeyPair()
Generate a new signing key pair
|
java.util.concurrent.CompletableFuture<NativeHandle> |
getAppPublicEncryptKey()
Get the public encryption key for the App
|
java.util.concurrent.CompletableFuture<NativeHandle> |
getAppPublicSignKey()
Get App's public sign key
|
java.util.concurrent.CompletableFuture<NativeHandle> |
getPublicEncryptKey(byte[] key)
Create a new public encryption key from byte array
|
java.util.concurrent.CompletableFuture<NativeHandle> |
getPublicSignKey(byte[] key)
Create a new public sign key from byte array
|
java.util.concurrent.CompletableFuture<byte[]> |
getRawPublicEncryptKey(NativeHandle publicEncKey)
Retrieves the public encryption key as byte array
|
java.util.concurrent.CompletableFuture<byte[]> |
getRawPublicSignKey(NativeHandle publicSignKey)
Retrieves public sign key as byte array
|
java.util.concurrent.CompletableFuture<byte[]> |
getRawSecretEncryptKey(NativeHandle secretEncKey)
Retrieves secret encryption key as byte array
|
java.util.concurrent.CompletableFuture<byte[]> |
getRawSecretSignKey(NativeHandle secretSignKey)
Retrieves secret sign key as byte array
|
java.util.concurrent.CompletableFuture<NativeHandle> |
getSecretEncryptKey(byte[] key)
Create a new secret encryption key from a raw array
|
java.util.concurrent.CompletableFuture<NativeHandle> |
getSecretSignKey(byte[] key)
Create a new secret signing key from byte array
|
static java.util.concurrent.CompletableFuture<byte[]> |
sha3Hash(byte[] data)
Generates a SHA3 hash of the given data
|
java.util.concurrent.CompletableFuture<byte[]> |
sign(NativeHandle secretSignKey,
byte[] data)
Sign data using a secret sign key
|
java.util.concurrent.CompletableFuture<byte[]> |
verify(NativeHandle publicSignKey,
byte[] signedData)
Verifies signed data using the public sign key
|
public Crypto(net.maidsafe.api.AppHandle handle)
handle
- App handlepublic static java.util.concurrent.CompletableFuture<byte[]> generateNonce()
public static java.util.concurrent.CompletableFuture<byte[]> sha3Hash(byte[] data)
data
- Data to be hashedpublic java.util.concurrent.CompletableFuture<NativeHandle> getAppPublicSignKey()
NativeHandle
public java.util.concurrent.CompletableFuture<SignKeyPair> generateSignKeyPair()
SignKeyPair
instancepublic java.util.concurrent.CompletableFuture<NativeHandle> getPublicSignKey(byte[] key)
key
- Byte arrayNativeHandle
instancepublic java.util.concurrent.CompletableFuture<NativeHandle> getSecretSignKey(byte[] key)
key
- Byte arrayNativeHandle
public java.util.concurrent.CompletableFuture<EncryptKeyPair> generateEncryptKeyPair()
EncryptKeyPair
instancepublic java.util.concurrent.CompletableFuture<NativeHandle> getAppPublicEncryptKey()
NativeHandle
public java.util.concurrent.CompletableFuture<NativeHandle> getPublicEncryptKey(byte[] key)
key
- Raw byte arrayNativeHandle
instancepublic java.util.concurrent.CompletableFuture<NativeHandle> getSecretEncryptKey(byte[] key)
key
- Raw byte arrayNativeHandle
instancepublic java.util.concurrent.CompletableFuture<byte[]> sign(NativeHandle secretSignKey, byte[] data)
secretSignKey
- Secret sign keydata
- Data to be signedpublic java.util.concurrent.CompletableFuture<byte[]> verify(NativeHandle publicSignKey, byte[] signedData)
publicSignKey
- Public sign keysignedData
- Signed datapublic java.util.concurrent.CompletableFuture<byte[]> encrypt(NativeHandle recipientPublicEncryptKey, NativeHandle senderSecretEncryptKey, byte[] data)
recipientPublicEncryptKey
- Recipient's private encryption keysenderSecretEncryptKey
- Sender's public encryption keydata
- Data to be encryptedpublic java.util.concurrent.CompletableFuture<byte[]> decrypt(NativeHandle senderPublicEncryptKey, NativeHandle recipientSecretEncryptKey, byte[] cipherText)
senderPublicEncryptKey
- Sender's public encryption keyrecipientSecretEncryptKey
- Recipient's private encryption keycipherText
- Encrypted datapublic java.util.concurrent.CompletableFuture<byte[]> encryptSealedBox(NativeHandle recipientPublicEncryptKey, byte[] data)
recipientPublicEncryptKey
- Recipient's public encryption keydata
- Data to be encryptedpublic java.util.concurrent.CompletableFuture<byte[]> decryptSealedBox(NativeHandle recipientPublicEncryptKey, NativeHandle recipientSecretEncryptKey, byte[] cipherText)
recipientPublicEncryptKey
- Recipient's public encryption keyrecipientSecretEncryptKey
- Recipient's secret encryption keycipherText
- Cipher to be decryptedpublic java.util.concurrent.CompletableFuture<byte[]> getRawPublicEncryptKey(NativeHandle publicEncKey)
publicEncKey
- Public encryption key as NativeHandle
public java.util.concurrent.CompletableFuture<byte[]> getRawSecretEncryptKey(NativeHandle secretEncKey)
secretEncKey
- Secret encryption key as NativeHandle
public java.util.concurrent.CompletableFuture<byte[]> getRawPublicSignKey(NativeHandle publicSignKey)
publicSignKey
- Public sign key as NativeHandle
public java.util.concurrent.CompletableFuture<byte[]> getRawSecretSignKey(NativeHandle secretSignKey)
secretSignKey
- Secret sign key as NativeHandle