Class SealedBoxUtility
- java.lang.Object
-
- com.venafi.vcert.sdk.connectors.cloud.SealedBoxUtility
-
public class SealedBoxUtility extends Object
The following utility is based on the SealBoxUtility code shared in the stackoverflow question How can I create or open a libsodium compatible sealed box in pure Java.The main difference is on this version is being used the org.bouncycastle.crypto.digests.Blake2bDigest from The Bouncy Castle Crypto Package For Java instead of Blake2b to get the Blake2b hash.
Has also a dependency on TweetNaclFast from https://github.com/InstantWebP2P/tweetnacl-java.
-
-
Field Summary
Fields Modifier and Type Field Description static intCRYPTO_BOX_NONCEBYTES
-
Constructor Summary
Constructors Constructor Description SealedBoxUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]cryptoBoxSeal(byte[] receiverPubKey, byte[] clearText)Encrypt in a sealed boxstatic byte[]cryptoBoxSealNonce(byte[] senderpk, byte[] mypk)hash the combination of senderpk + mypk into nonce using blake2b hash
-
-
-
Field Detail
-
CRYPTO_BOX_NONCEBYTES
public static final int CRYPTO_BOX_NONCEBYTES
- See Also:
- Constant Field Values
-
-
Method Detail
-
cryptoBoxSeal
public static byte[] cryptoBoxSeal(byte[] receiverPubKey, byte[] clearText) throws GeneralSecurityExceptionEncrypt in a sealed box- Parameters:
receiverPubKey- receiver public keyclearText- clear text- Returns:
- encrypted message
- Throws:
GeneralSecurityException
-
cryptoBoxSealNonce
public static byte[] cryptoBoxSealNonce(byte[] senderpk, byte[] mypk)hash the combination of senderpk + mypk into nonce using blake2b hash- Parameters:
senderpk- the senders public keymypk- my own public key- Returns:
- the nonce computed using Blake2b generic hash
-
-