📄 dst.h
字号:
* \li "mctx" is a valid memory context. * \li "keyp" is not NULL and "*keyp" is NULL. * * Returns: * \li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: * \li If successful, *keyp will contain a valid key, and the consumed * pointer in data will be advanced. */isc_result_tdst_key_todns(const dst_key_t *key, isc_buffer_t *target);/*%< * Converts a DST key into a DNS KEY record. * * Requires: * \li "key" is a valid key. * \li "target" is a valid buffer. There must be at least 4 bytes unused. * * Returns: * \li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: * \li If successful, the used pointer in 'target' is advanced by at least 4. */isc_result_tdst_key_frombuffer(dns_name_t *name, unsigned int alg, unsigned int flags, unsigned int protocol, dns_rdataclass_t rdclass, isc_buffer_t *source, isc_mem_t *mctx, dst_key_t **keyp);/*%< * Converts a buffer containing DNS KEY RDATA into a DST key. * * Requires: *\li "name" is a valid absolute dns name. *\li "alg" is a supported key algorithm. *\li "source" is a valid buffer. *\li "mctx" is a valid memory context. *\li "keyp" is not NULL and "*keyp" is NULL. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, *keyp will contain a valid key, and the consumed * pointer in source will be advanced. */isc_result_tdst_key_tobuffer(const dst_key_t *key, isc_buffer_t *target);/*%< * Converts a DST key into DNS KEY RDATA format. * * Requires: *\li "key" is a valid key. *\li "target" is a valid buffer. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, the used pointer in 'target' is advanced. */isc_result_tdst_key_privatefrombuffer(dst_key_t *key, isc_buffer_t *buffer);/*%< * Converts a public key into a private key, reading the private key * information from the buffer. The buffer should contain the same data * as the .private key file would. * * Requires: *\li "key" is a valid public key. *\li "buffer" is not NULL. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, key will contain a valid private key. */isc_result_tdst_key_fromgssapi(dns_name_t *name, void *opaque, isc_mem_t *mctx, dst_key_t **keyp);/*%< * Converts a GSSAPI opaque context id into a DST key. * * Requires: *\li "name" is a valid absolute dns name. *\li "opaque" is a GSSAPI context id. *\li "mctx" is a valid memory context. *\li "keyp" is not NULL and "*keyp" is NULL. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, *keyp will contain a valid key and be responsible for * the context id. */isc_result_tdst_key_generate(dns_name_t *name, unsigned int alg, unsigned int bits, unsigned int param, unsigned int flags, unsigned int protocol, dns_rdataclass_t rdclass, isc_mem_t *mctx, dst_key_t **keyp);/*%< * Generate a DST key (or keypair) with the supplied parameters. The * interpretation of the "param" field depends on the algorithm: * \code * RSA: exponent * 0 use exponent 3 * !0 use Fermat4 (2^16 + 1) * DH: generator * 0 default - use well known prime if bits == 768 or 1024, * otherwise use 2 as the generator. * !0 use this value as the generator. * DSA: unused * HMACMD5: entropy * 0 default - require good entropy * !0 lack of good entropy is ok *\endcode * * Requires: *\li "name" is a valid absolute dns name. *\li "keyp" is not NULL and "*keyp" is NULL. * * Returns: *\li ISC_R_SUCCESS * \li any other result indicates failure * * Ensures: *\li If successful, *keyp will contain a valid key. */isc_boolean_tdst_key_compare(const dst_key_t *key1, const dst_key_t *key2);/*%< * Compares two DST keys. * * Requires: *\li "key1" is a valid key. *\li "key2" is a valid key. * * Returns: *\li ISC_TRUE * \li ISC_FALSE */isc_boolean_tdst_key_paramcompare(const dst_key_t *key1, const dst_key_t *key2);/*%< * Compares the parameters of two DST keys. This is used to determine if * two (Diffie-Hellman) keys can be used to derive a shared secret. * * Requires: *\li "key1" is a valid key. *\li "key2" is a valid key. * * Returns: *\li ISC_TRUE * \li ISC_FALSE */voiddst_key_free(dst_key_t **keyp);/*%< * Release all memory associated with the key. * * Requires: *\li "keyp" is not NULL and "*keyp" is a valid key. * * Ensures: *\li All memory associated with "*keyp" will be freed. *\li *keyp == NULL *//*%< * Accessor functions to obtain key fields. * * Require: *\li "key" is a valid key. */dns_name_t *dst_key_name(const dst_key_t *key);unsigned intdst_key_size(const dst_key_t *key);unsigned intdst_key_proto(const dst_key_t *key);unsigned intdst_key_alg(const dst_key_t *key);isc_uint32_tdst_key_flags(const dst_key_t *key);dns_keytag_tdst_key_id(const dst_key_t *key);dns_rdataclass_tdst_key_class(const dst_key_t *key);isc_boolean_tdst_key_isprivate(const dst_key_t *key);isc_boolean_tdst_key_iszonekey(const dst_key_t *key);isc_boolean_tdst_key_isnullkey(const dst_key_t *key);isc_result_tdst_key_buildfilename(const dst_key_t *key, int type, const char *directory, isc_buffer_t *out);/*%< * Generates the filename used by dst to store the specified key. * If directory is NULL, the current directory is assumed. * * Requires: *\li "key" is a valid key *\li "type" is either DST_TYPE_PUBLIC, DST_TYPE_PRIVATE, or 0 for no suffix. *\li "out" is a valid buffer * * Ensures: *\li the file name will be written to "out", and the used pointer will * be advanced. */isc_result_tdst_key_sigsize(const dst_key_t *key, unsigned int *n);/*%< * Computes the size of a signature generated by the given key. * * Requires: *\li "key" is a valid key. *\li "n" is not NULL * * Returns: *\li #ISC_R_SUCCESS *\li DST_R_UNSUPPORTEDALG * * Ensures: *\li "n" stores the size of a generated signature */isc_result_tdst_key_secretsize(const dst_key_t *key, unsigned int *n);/*%< * Computes the size of a shared secret generated by the given key. * * Requires: *\li "key" is a valid key. *\li "n" is not NULL * * Returns: *\li #ISC_R_SUCCESS *\li DST_R_UNSUPPORTEDALG * * Ensures: *\li "n" stores the size of a generated shared secret */isc_uint16_tdst_region_computeid(const isc_region_t *source, unsigned int alg);/*%< * Computes the key id of the key stored in the provided region with the * given algorithm. * * Requires: *\li "source" contains a valid, non-NULL region. * * Returns: *\li the key id */isc_uint16_tdst_key_getbits(const dst_key_t *key);/* * Get the number of digest bits required (0 == MAX). * * Requires: * "key" is a valid key. */voiddst_key_setbits(dst_key_t *key, isc_uint16_t bits);/* * Set the number of digest bits required (0 == MAX). * * Requires: * "key" is a valid key. */ISC_LANG_ENDDECLS#endif /* DST_DST_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -