-
public interface Sign.Native
-
-
Method Summary
Modifier and Type Method Description abstract booleancryptoSignInit(Sign.StateCryptoSign state)Useful for signing a multi-part message (Ed25519ph).If the message can fit in memory and can be supplied as asingle chunk, the single-part API should be preferred.This function must be called before the first crypto_sign_update() call. abstract booleancryptoSignUpdate(Sign.StateCryptoSign state, Array<byte> chunk, int chunkLength)Add a new chunk of length chunkLen bytes to themessage that will eventually be signed. abstract booleancryptoSignFinalCreate(Sign.StateCryptoSign state, Array<byte> sig, Array<byte> sk)This function computes a signature for the previously supplied message,using the secret key sk and puts it into sig. abstract booleancryptoSignFinalVerify(Sign.StateCryptoSign state, Array<byte> sig, Array<byte> pk)Verifies that sig is a valid signature for the message whosecontent has been previously supplied using crypto_update(),using the public key pk. abstract booleancryptoSignKeypair(Array<byte> publicKey, Array<byte> secretKey)Generate a signing keypair (ed25519). abstract booleancryptoSignSeedKeypair(Array<byte> publicKey, Array<byte> secretKey, Array<byte> seed)Deterministically generate a public and secret key. abstract booleancryptoSign(Array<byte> signedMessage, Array<byte> message, int messageLen, Array<byte> secretKey)Sign a message. abstract booleancryptoSignOpen(Array<byte> message, Array<byte> signedMessage, int signedMessageLen, Array<byte> publicKey)Verify a signed message. abstract booleancryptoSignDetached(Array<byte> signature, Array<byte> message, int messageLen, Array<byte> secretKey)Returns a signature for a message. abstract booleancryptoSignVerifyDetached(Array<byte> signature, Array<byte> message, int messageLen, Array<byte> publicKey)Verifies that {@code signature}is valid for the{@code message}.abstract booleanconvertPublicKeyEd25519ToCurve25519(Array<byte> curve, Array<byte> ed)Converts a public ed25519 key to a public curve25519 key. abstract booleanconvertSecretKeyEd25519ToCurve25519(Array<byte> curve, Array<byte> ed)Converts a secret ed25519 key to a secret curve25519 key. abstract booleancryptoSignEd25519SkToSeed(Array<byte> seed, Array<byte> ed)Extracts the seed value from a secret ed25519 key. abstract booleancryptoSignEd25519SkToPk(Array<byte> publicKey, Array<byte> ed)Extracts the ed25519 public key from a secret ed25519 key. -
-
Method Detail
-
cryptoSignInit
abstract boolean cryptoSignInit(Sign.StateCryptoSign state)
Useful for signing a multi-part message (Ed25519ph).If the message can fit in memory and can be supplied as asingle chunk, the single-part API should be preferred.This function must be called before the first crypto_sign_update() call.
- Parameters:
state- The state.
-
cryptoSignUpdate
abstract boolean cryptoSignUpdate(Sign.StateCryptoSign state, Array<byte> chunk, int chunkLength)
Add a new chunk of length chunkLen bytes to themessage that will eventually be signed.
- Parameters:
state- The state.chunk- A part of the long message.chunkLength- Message length.
-
cryptoSignFinalCreate
abstract boolean cryptoSignFinalCreate(Sign.StateCryptoSign state, Array<byte> sig, Array<byte> sk)
This function computes a signature for the previously supplied message,using the secret key sk and puts it into sig.
- Parameters:
state- The state.sig- Resultant signature.sk- Secret key.
-
cryptoSignFinalVerify
abstract boolean cryptoSignFinalVerify(Sign.StateCryptoSign state, Array<byte> sig, Array<byte> pk)
Verifies that sig is a valid signature for the message whosecontent has been previously supplied using crypto_update(),using the public key pk.
- Parameters:
state- The state.sig- Resultant signature.pk- Secret key.
-
cryptoSignKeypair
abstract boolean cryptoSignKeypair(Array<byte> publicKey, Array<byte> secretKey)
Generate a signing keypair (ed25519).
- Parameters:
publicKey- Public key.secretKey- Secret key.
-
cryptoSignSeedKeypair
abstract boolean cryptoSignSeedKeypair(Array<byte> publicKey, Array<byte> secretKey, Array<byte> seed)
Deterministically generate a public and secret key.
- Parameters:
publicKey- Public key.secretKey- Secret key.seed- The seed used to generate the keys.
-
cryptoSign
abstract boolean cryptoSign(Array<byte> signedMessage, Array<byte> message, int messageLen, Array<byte> secretKey)
Sign a message.
- Parameters:
signedMessage- Signed message will be placed here.message- The message.messageLen- The message length.secretKey- The secret key.
-
cryptoSignOpen
abstract boolean cryptoSignOpen(Array<byte> message, Array<byte> signedMessage, int signedMessageLen, Array<byte> publicKey)
Verify a signed message.
- Parameters:
message- The message will be placed in here.signedMessage- The signed message.signedMessageLen- The signed message length.publicKey- Public key.
-
cryptoSignDetached
abstract boolean cryptoSignDetached(Array<byte> signature, Array<byte> message, int messageLen, Array<byte> secretKey)
Returns a signature for a message. Thisdoes not prepend the signature to the message.See cryptoSign for that.
- Parameters:
signature- The signature will be added to this byte array.message- The message to sign.messageLen- The message length.secretKey- The secret key.
-
cryptoSignVerifyDetached
abstract boolean cryptoSignVerifyDetached(Array<byte> signature, Array<byte> message, int messageLen, Array<byte> publicKey)
Verifies that
{@code signature}is valid for the{@code message}.- Parameters:
signature- The signature.message- The message.messageLen- The message length.publicKey- The public key that signed the message.
-
convertPublicKeyEd25519ToCurve25519
abstract boolean convertPublicKeyEd25519ToCurve25519(Array<byte> curve, Array<byte> ed)
Converts a public ed25519 key to a public curve25519 key.
- Parameters:
curve- The array in which the generated key will be placed.ed- The public key in ed25519.
-
convertSecretKeyEd25519ToCurve25519
abstract boolean convertSecretKeyEd25519ToCurve25519(Array<byte> curve, Array<byte> ed)
Converts a secret ed25519 key to a secret curve25519 key.
- Parameters:
curve- The array in which the generated key will be placed.ed- The secret key in ed25519.
-
cryptoSignEd25519SkToSeed
abstract boolean cryptoSignEd25519SkToSeed(Array<byte> seed, Array<byte> ed)
Extracts the seed value from a secret ed25519 key.
- Parameters:
seed- The array in which the seed value will be placed.ed- The secret key in ed25519.
-
cryptoSignEd25519SkToPk
abstract boolean cryptoSignEd25519SkToPk(Array<byte> publicKey, Array<byte> ed)
Extracts the ed25519 public key from a secret ed25519 key.
- Parameters:
publicKey- The array in which the public key will be placed.ed- The secret key in ed25519.
-
-
-
-