ED25519 signature functions. More...
Functions | |
byte * | pcp_ed_sign (byte *message, size_t messagesize, pcp_key_t *s) |
Sign a raw message. More... | |
byte * | pcp_ed_sign_key (byte *message, size_t messagesize, pcp_key_t *s) |
Sign a raw message using s->mastersecret. More... | |
byte * | pcp_ed_verify (PCPCTX *ptx, byte *signature, size_t siglen, pcp_pubkey_t *p) |
Verify a signature. More... | |
byte * | pcp_ed_verify_key (PCPCTX *ptx, byte *signature, size_t siglen, pcp_pubkey_t *p) |
Verify a signature using the mastersecret. More... | |
size_t | pcp_ed_sign_buffered (PCPCTX *ptx, Pcpstream *in, Pcpstream *out, pcp_key_t *s, int z85) |
Sign a stream in 32k block mode. More... | |
pcp_pubkey_t * | pcp_ed_verify_buffered (PCPCTX *ptx, Pcpstream *in, pcp_pubkey_t *p) |
Verify a signature from a stream in 32k block mode. More... | |
size_t | pcp_ed_detachsign_buffered (Pcpstream *in, Pcpstream *out, pcp_key_t *s) |
Generate a detached signature from a stream in 32k block mode. More... | |
pcp_pubkey_t * | pcp_ed_detachverify_buffered (PCPCTX *ptx, Pcpstream *in, Pcpstream *sigfd, pcp_pubkey_t *p) |
Verify a detached signature from a stream in 32k block mode. More... | |
ED25519 signature functions.
Generate a detached signature from a stream in 32k block mode.
This function reads blockwise from the stream in and generates a hash of the contents of the stream. It then signs that hash and writes the hash and the signature to the output stream out.
[in] | in | Stream to read from. |
[out] | out | Stream to write to. |
[in] | s | Pointer to secret key. |
pcp_pubkey_t* pcp_ed_detachverify_buffered | ( | PCPCTX * | ptx, |
Pcpstream * | in, | ||
Pcpstream * | sigfd, | ||
pcp_pubkey_t * | p | ||
) |
Verify a detached signature from a stream in 32k block mode.
This function reads blockwise from the stream in and generates a hash of the contents of the stream. It then reads the signature from the stream sigfd and verifies the signature from it using p->edpub and compares the signature hash with the hash it calculated from the signed content.
[in] | ptx | pcp context. |
[in] | in | Stream to read from. |
[in] | sigfd | Stream containing the detached signature. |
[in] | p | Pointer to public key structure. |
byte* pcp_ed_sign | ( | byte * | message, |
size_t | messagesize, | ||
pcp_key_t * | s | ||
) |
Sign a raw message.
Sign a message of messagesize using s->edsecret. This is just a convenience wrapper around crypto_sign().
[in] | message | The message to sign. |
[in] | messagesize | Size of the message. |
[in] | s | Pointer to secret key structure. |
size_t pcp_ed_sign_buffered | ( | PCPCTX * | ptx, |
Pcpstream * | in, | ||
Pcpstream * | out, | ||
pcp_key_t * | s, | ||
int | z85 | ||
) |
Sign a stream in 32k block mode.
This function reads blockwise from the stream in and generates a hash of the contents of the stream. It outputs the stream to out, also blockwise and appends the signature afterwards, which consists of the hash+nacl-signature.
[in] | ptx | pcp context. |
[in] | in | Stream to read from. |
[out] | out | Stream to write to. |
[in] | s | Pointer to secret key. |
[in] | z85 | Flag which indicates if to create an armored signature or not. 1=armored, 0=raw. |
byte* pcp_ed_sign_key | ( | byte * | message, |
size_t | messagesize, | ||
pcp_key_t * | s | ||
) |
Sign a raw message using s->mastersecret.
The same as pcp_ed_sign() but uses the mastersecret for signing. Usually used for key signing only.
[in] | message | The message to sign. |
[in] | messagesize | Size of the message. |
[in] | s | Pointer to secret key structure. |
byte* pcp_ed_verify | ( | PCPCTX * | ptx, |
byte * | signature, | ||
size_t | siglen, | ||
pcp_pubkey_t * | p | ||
) |
Verify a signature.
Verify a signature of size siglen using p->edpub.
The signature must contain the message+nacl signature (with size crypto_sign_BYTES).
[in] | ptx | pcp context. |
[in] | signature | Message+signature. |
[in] | siglen | Size of message+signature. |
[in] | p | Pointer to public key structure. |
pcp_pubkey_t* pcp_ed_verify_buffered | ( | PCPCTX * | ptx, |
Pcpstream * | in, | ||
pcp_pubkey_t * | p | ||
) |
Verify a signature from a stream in 32k block mode.
This function reads blockwise from the stream in and generates a hash of the contents of the stream. While reading from the stream it extracts the appended signature (hash+sig). It then verifies the signature using p->edpub and compares the signature hash with the hash it calculated from the signed content.
The parameter p can be NULL. In this case the function loops through the global public key hash pcppubkey_hash to find a public key which is able to verify the signature.
[in] | ptx | pcp context. |
[in] | in | Stream to read from. |
[in] | p | Pointer to public key structure. |
byte* pcp_ed_verify_key | ( | PCPCTX * | ptx, |
byte * | signature, | ||
size_t | siglen, | ||
pcp_pubkey_t * | p | ||
) |
Verify a signature using the mastersecret.
Verify a signature of size siglen using p->masterpub.
The signature must contain the message+nacl signature (with size crypto_sign_BYTES).
[in] | ptx | pcp context. |
[in] | signature | Message+signature. |
[in] | siglen | Size of message+signature. |
[in] | p | Pointer to public key structure. |