Package com.goterl.lazysodium.interfaces
Interface Sign.Lazy
-
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- Sign
public static interface Sign.Lazy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description KeyPairconvertKeyPairEd25519ToCurve25519(KeyPair ed25519KeyPair)Converts a ed25519 keypair to a curve25519 keypair.java.lang.StringcryptoSign(java.lang.String message, Key secretKey)Sign a message.java.lang.StringcryptoSign(java.lang.String message, java.lang.String secretKey)Sign a message.java.lang.StringcryptoSignDetached(java.lang.String message, Key secretKey)Returns a signature for a message.KeyPaircryptoSignKeypair()Generate a signing keypair (ed25519).java.lang.StringcryptoSignOpen(java.lang.String signedMessage, Key publicKey)Checks that a message is validly signed by a public key.KeyPaircryptoSignSecretKeyPair(Key secretKey)Generate a signing keypair (ed25519), given a secret ed25519 key.KeyPaircryptoSignSeedKeypair(byte[] seed)Generate a signing keypair deterministically.booleancryptoSignVerifyDetached(java.lang.String signature, java.lang.String message, Key publicKey)Verifies thatsignatureis valid for themessage.
-
-
-
Method Detail
-
cryptoSignKeypair
KeyPair cryptoSignKeypair() throws SodiumException
Generate a signing keypair (ed25519).- Returns:
- Public and private keypair.
- Throws:
SodiumException
-
cryptoSignSeedKeypair
KeyPair cryptoSignSeedKeypair(byte[] seed) throws SodiumException
Generate a signing keypair deterministically.- Parameters:
seed- The seed to generate keys.- Returns:
- Public and private keypair.
- Throws:
SodiumException
-
cryptoSignSecretKeyPair
KeyPair cryptoSignSecretKeyPair(Key secretKey) throws SodiumException
Generate a signing keypair (ed25519), given a secret ed25519 key.- Parameters:
secretKey- The ed25519 secret key.- Returns:
- The private and public ed25519 keys.
- Throws:
SodiumException
-
cryptoSign
java.lang.String cryptoSign(java.lang.String message, java.lang.String secretKey) throws SodiumExceptionSign a message.- Parameters:
message- The message to sign.secretKey- The secret key.- Returns:
- A
Helpers.Lazy.sodiumBin2Hex(byte[])-ified signed message. - Throws:
SodiumException
-
cryptoSign
java.lang.String cryptoSign(java.lang.String message, Key secretKey) throws SodiumExceptionSign a message.- Parameters:
message- The message to sign.secretKey- The secret key.- Returns:
- A
Helpers.Lazy.sodiumBin2Hex(byte[])-ified signed message. - Throws:
SodiumException
-
cryptoSignOpen
java.lang.String cryptoSignOpen(java.lang.String signedMessage, Key publicKey)Checks that a message is validly signed by a public key.- Parameters:
signedMessage- The signed message.publicKey- The public key that signed the message.- Returns:
- Returns the message without a signature. If null, then the message is not validly signed by the publicKey.
-
cryptoSignDetached
java.lang.String cryptoSignDetached(java.lang.String message, Key secretKey) throws SodiumExceptionReturns a signature for a message. This does not prepend the signature to the message. SeecryptoSign(String, String)for that.- Parameters:
message- The message to sign.secretKey- The secret key.- Returns:
- The signature for a message.
- Throws:
SodiumException- If could not sign.
-
cryptoSignVerifyDetached
boolean cryptoSignVerifyDetached(java.lang.String signature, java.lang.String message, Key publicKey)Verifies thatsignatureis valid for themessage.- Parameters:
signature- The signature.message- The message.publicKey- The public key that signed the message.- Returns:
- Returns true if the signature is valid for the message.
- See Also:
cryptoSignDetached(String, Key)
-
convertKeyPairEd25519ToCurve25519
KeyPair convertKeyPairEd25519ToCurve25519(KeyPair ed25519KeyPair) throws SodiumException
Converts a ed25519 keypair to a curve25519 keypair.- Parameters:
ed25519KeyPair- The key pair.- Returns:
- curve25519KeyPair
- Throws:
SodiumException- If conversion was unsuccessful.
-
-