mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 03:50:57 +01:00
added pcpkey_setowner(), removed pcp[pub]key_exists() (unused currently)
This commit is contained in:
@@ -245,34 +245,6 @@ byte *pcppubkey_getchecksum(pcp_pubkey_t *k);
|
|||||||
byte *pcpkey_getchecksum(pcp_key_t *k);
|
byte *pcpkey_getchecksum(pcp_key_t *k);
|
||||||
|
|
||||||
|
|
||||||
/** Checks if a secret key structure is registered in the secret key hash.
|
|
||||||
|
|
||||||
Returns a pointer to a pcp_key_t structure if there
|
|
||||||
exists a secret key structure with the given id in the
|
|
||||||
secret key hash.
|
|
||||||
|
|
||||||
FIXME: needs to be moved to keyhash.h.
|
|
||||||
|
|
||||||
\param[in] id A null-terminated char pointer of 17 bytes containing a key-id.
|
|
||||||
|
|
||||||
\return Returns a pointer to a pcp_key_t struture or NULL if no key exists.
|
|
||||||
*/
|
|
||||||
pcp_key_t *pcpkey_exists(char *id);
|
|
||||||
|
|
||||||
/** Checks if a public key structure is registered in the public key hash.
|
|
||||||
|
|
||||||
Returns a pointer to a pcp_pubkey_t structure if there
|
|
||||||
exists a public key structure with the given id in the
|
|
||||||
public key hash.
|
|
||||||
|
|
||||||
FIXME: needs to be moved to keyhash.h.
|
|
||||||
|
|
||||||
\param[in] id A null-terminated char pointer of 17 bytes containing a key-id.
|
|
||||||
|
|
||||||
\return Returns a pointer to a pcp_pubkey_t struture or NULL if no key exists.
|
|
||||||
*/
|
|
||||||
pcp_pubkey_t *pcppubkey_exists(char *id);
|
|
||||||
|
|
||||||
pcp_key_t * key2be(pcp_key_t *k);
|
pcp_key_t * key2be(pcp_key_t *k);
|
||||||
pcp_key_t *key2native(pcp_key_t *k);
|
pcp_key_t *key2native(pcp_key_t *k);
|
||||||
pcp_pubkey_t * pubkey2be(pcp_pubkey_t *k);
|
pcp_pubkey_t * pubkey2be(pcp_pubkey_t *k);
|
||||||
@@ -332,6 +304,13 @@ void pcp_dumpkey(pcp_key_t *k);
|
|||||||
*/
|
*/
|
||||||
void pcp_dumppubkey(pcp_pubkey_t *k);
|
void pcp_dumppubkey(pcp_pubkey_t *k);
|
||||||
|
|
||||||
|
/** Set Owner and Mail.
|
||||||
|
|
||||||
|
\param[in] key The secret key structure.
|
||||||
|
\param[in] owner Owner string.
|
||||||
|
\param[in] mail Email string.
|
||||||
|
*/
|
||||||
|
void pcpkey_setowner(pcp_key_t *key, char *owner, char *mail);
|
||||||
|
|
||||||
#endif /* _HAVE_PCP_KEYPAIR_H */
|
#endif /* _HAVE_PCP_KEYPAIR_H */
|
||||||
|
|
||||||
|
|||||||
@@ -144,6 +144,11 @@ byte * pcp_gennonce() {
|
|||||||
return nonce;
|
return nonce;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pcpkey_setowner(pcp_key_t *key, char *owner, char *mail) {
|
||||||
|
strcpy(key->owner, owner);
|
||||||
|
strcpy(key->mail, mail);
|
||||||
|
}
|
||||||
|
|
||||||
pcp_key_t *pcpkey_encrypt(PCPCTX *ptx, pcp_key_t *key, char *passphrase) {
|
pcp_key_t *pcpkey_encrypt(PCPCTX *ptx, pcp_key_t *key, char *passphrase) {
|
||||||
if(key->nonce[0] == 0) {
|
if(key->nonce[0] == 0) {
|
||||||
byte *nonce = pcp_gennonce();
|
byte *nonce = pcp_gennonce();
|
||||||
@@ -216,7 +221,6 @@ pcp_key_t *pcpkey_decrypt(PCPCTX *ptx, pcp_key_t *key, char *passphrase) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pcp_pubkey_t *pcpkey_pub_from_secret(pcp_key_t *key) {
|
pcp_pubkey_t *pcpkey_pub_from_secret(pcp_key_t *key) {
|
||||||
/* pcp_dumpkey(key); */
|
|
||||||
pcp_pubkey_t *pub = urmalloc(sizeof (pcp_pubkey_t));
|
pcp_pubkey_t *pub = urmalloc(sizeof (pcp_pubkey_t));
|
||||||
memcpy(pub->masterpub, key->masterpub, 32);
|
memcpy(pub->masterpub, key->masterpub, 32);
|
||||||
memcpy(pub->pub, key->pub, 32);
|
memcpy(pub->pub, key->pub, 32);
|
||||||
|
|||||||
Reference in New Issue
Block a user