keytools.h
上传用户:wxp200602
上传日期:2007-10-30
资源大小:4028k
文件大小:2k
源码类别:

SNMP编程

开发平台:

Unix_Linux

  1. /*
  2.  * keytools.h
  3.  */
  4. #ifndef _KEYTOOLS_H
  5. #define _KEYTOOLS_H
  6. #ifdef __cplusplus
  7. extern          "C" {
  8. #endif
  9. #define USM_LENGTH_EXPANDED_PASSPHRASE (1024 * 1024)   /* 1Meg. */
  10. #define USM_LENGTH_KU_HASHBLOCK 64      /* In bytes. */
  11. #define USM_LENGTH_P_MIN 8       /* In characters. */
  12.     /*
  13.      * Recommended practice given in <draft-ietf-snmpv3-usm-v2-02.txt>,
  14.      * * Section 11.2 "Defining Users".  Move into cmdline app argument
  15.      * * parsing, and out of the internal routine?  XXX
  16.      */
  17.     /*
  18.      * Prototypes.h
  19.      */
  20.     int             generate_Ku(const oid * hashtype, u_int hashtype_len,
  21.                                 u_char * P, size_t pplen,
  22.                                 u_char * Ku, size_t * kulen);
  23.     int             generate_kul(const oid * hashtype, u_int hashtype_len,
  24.                                  u_char * engineID, size_t engineID_len,
  25.                                  u_char * Ku, size_t ku_len,
  26.                                  u_char * Kul, size_t * kul_len);
  27.     int             encode_keychange(const oid * hashtype,
  28.                                      u_int hashtype_len, u_char * oldkey,
  29.                                      size_t oldkey_len, u_char * newkey,
  30.                                      size_t newkey_len, u_char * kcstring,
  31.                                      size_t * kcstring_len);
  32.     int             decode_keychange(const oid * hashtype,
  33.                                      u_int hashtype_len, u_char * oldkey,
  34.                                      size_t oldkey_len, u_char * kcstring,
  35.                                      size_t kcstring_len, u_char * newkey,
  36.                                      size_t * newkey_len);
  37.     /*
  38.      * All functions devolve to the following block if we can't do cryptography
  39.      */
  40. #define _KEYTOOLS_NOT_AVAILABLE
  41. {
  42. return SNMPERR_KT_NOT_AVAILABLE;
  43. }
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif                          /* _KEYTOOLS_H */