mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 03:50:57 +01:00
abandoned yaml, perl and c key exporters, added json exporter using libjansson, enable with --with-json
This commit is contained in:
@@ -160,9 +160,6 @@
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
|
||||
@@ -163,10 +163,6 @@ typedef enum _PCP_KEY_TYPES {
|
||||
/* pubkey export formats */
|
||||
#define EXP_FORMAT_NATIVE 1
|
||||
#define EXP_FORMAT_PBP 2
|
||||
#define EXP_FORMAT_YAML 3
|
||||
#define EXP_FORMAT_C 4
|
||||
#define EXP_FORMAT_PY 5
|
||||
#define EXP_FORMAT_PERL 6
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -47,6 +47,10 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_JSON
|
||||
#include <jansson.h>
|
||||
#endif
|
||||
|
||||
#include "defines.h"
|
||||
#include "platform.h"
|
||||
#include "structs.h"
|
||||
@@ -58,7 +62,7 @@
|
||||
#include "scrypt.h"
|
||||
#include "context.h"
|
||||
|
||||
/* key management api, export, import, yaml and stuff */
|
||||
/* key management api, export, import, and stuff */
|
||||
|
||||
|
||||
/**
|
||||
@@ -163,7 +167,8 @@
|
||||
blob in the format described above.
|
||||
|
||||
*/
|
||||
Buffer *pcp_export_rfc_pub (pcp_key_t *sk);
|
||||
Buffer *pcp_export_rfc_pub (PCPCTX *ptx, pcp_key_t *sk);
|
||||
|
||||
|
||||
|
||||
/** Export a public key in PBP format.
|
||||
@@ -178,39 +183,6 @@ Buffer *pcp_export_rfc_pub (pcp_key_t *sk);
|
||||
*/
|
||||
Buffer *pcp_export_pbp_pub(pcp_key_t *sk);
|
||||
|
||||
/** Export a public key in yaml format.
|
||||
Export a public key in yaml format.
|
||||
|
||||
\param sk a secret key structure of type pcp_key_t. The secret keys
|
||||
in there have to be already decrypted.
|
||||
|
||||
\return the function returns a Buffer object containing the binary
|
||||
blob containing a YAML string.
|
||||
*/
|
||||
Buffer *pcp_export_yaml_pub(pcp_key_t *sk);
|
||||
|
||||
/** Export a public key in perl code format.
|
||||
Export a public key in perl code format.
|
||||
|
||||
\param sk a secret key structure of type pcp_key_t. The secret keys
|
||||
in there have to be already decrypted.
|
||||
|
||||
\return the function returns a Buffer object containing the binary
|
||||
blob containing a perl code string (a hash definition).
|
||||
*/
|
||||
Buffer *pcp_export_perl_pub(pcp_key_t *sk);
|
||||
|
||||
/** Export a public key in C code format.
|
||||
Export a public key in C code format.
|
||||
|
||||
\param sk a secret key structure of type pcp_key_t. The secret keys
|
||||
in there have to be already decrypted.
|
||||
|
||||
\return the function returns a Buffer object containing the binary
|
||||
blob containing a C code string.
|
||||
*/
|
||||
Buffer *pcp_export_c_pub(pcp_key_t *sk);
|
||||
|
||||
/** Export secret key.
|
||||
|
||||
Export a secret key.
|
||||
@@ -255,6 +227,37 @@ Buffer *pcp_export_c_pub(pcp_key_t *sk);
|
||||
*/
|
||||
Buffer *pcp_export_secret(PCPCTX *ptx, pcp_key_t *sk, char *passphrase);
|
||||
|
||||
#ifdef HAVE_JSON
|
||||
/** Export public key in JSON format
|
||||
|
||||
\param[in] sk a secret key structure of type pcp_key_t. The secret keys
|
||||
in there have to be already decrypted.
|
||||
\param[in] sig the keysig blob.
|
||||
|
||||
\return the function returns a Buffer object containing the binary
|
||||
blob containing a JSON string.
|
||||
*/
|
||||
Buffer *pcp_export_json_pub(PCPCTX *ptx, pcp_key_t *sk, byte *sig);
|
||||
|
||||
/** Export secret key in JSON format
|
||||
|
||||
\param[in] sk a secret key structure of type pcp_key_t. The secret keys
|
||||
in there have to be already decrypted.
|
||||
\param[in] nonce the nonce used to encrypt secret keys
|
||||
\param[in] cipher the encrypted secret keys
|
||||
\param[in] clen len of cipher
|
||||
|
||||
\return the function returns a Buffer object containing the binary
|
||||
blob containing a JSON string.
|
||||
*/
|
||||
Buffer *pcp_export_json_secret(PCPCTX *ptx, pcp_key_t *sk, byte *nonce, byte *cipher, size_t clen);
|
||||
|
||||
json_t *pcp_pub2jsont(pcp_key_t *sk, byte *sig);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
pcp_ks_bundle_t *pcp_import_binpub(PCPCTX *ptx, byte *raw, size_t rawsize);
|
||||
pcp_ks_bundle_t *pcp_import_pub(PCPCTX *ptx, byte *raw, size_t rawsize); /* FIXME: deprecate */
|
||||
pcp_ks_bundle_t *pcp_import_pub_rfc(PCPCTX *ptx, Buffer *blob);
|
||||
|
||||
@@ -195,7 +195,9 @@ struct _pcp_ctx_t {
|
||||
byte pcp_errset; /**< indicates if an error occurred. */
|
||||
int pcp_exit; /**< exit code for pcp commandline utility */
|
||||
int verbose; /**< enable verbose output */
|
||||
|
||||
#ifdef HAVE_JSON
|
||||
int json; /**< enable json i/o */
|
||||
#endif
|
||||
pcp_key_t *pcpkey_hash; /**< hash containing for keys */
|
||||
pcp_pubkey_t *pcppubkey_hash; /**< hash for keys. */
|
||||
pcp_keysig_t *pcpkeysig_hash; /**< hash for key sigs */
|
||||
|
||||
@@ -99,6 +99,16 @@ void _xorbuf(byte *iv, byte *buf, size_t xlen);
|
||||
*/
|
||||
void _dump(char *n, byte *d, size_t s);
|
||||
|
||||
|
||||
/** return hex string of binary data
|
||||
\param[in] bin byte array
|
||||
\param[in] len size of byte array
|
||||
\return Returns malloc'd hex string. Caller must free.
|
||||
*/
|
||||
char *_bin2hex(byte *bin, size_t len);
|
||||
|
||||
|
||||
|
||||
#endif /* _HAVE_PCP_UTIL_H */
|
||||
|
||||
/**@}*/
|
||||
|
||||
Reference in New Issue
Block a user