keytools.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. NETSNMP_IMPORT
  21. int generate_Ku(const oid * hashtype, u_int hashtype_len,
  22. const u_char * P, size_t pplen,
  23. u_char * Ku, size_t * kulen);
  24. NETSNMP_IMPORT
  25. int generate_kul(const oid * hashtype, u_int hashtype_len,
  26. const u_char * engineID, size_t engineID_len,
  27. const u_char * Ku, size_t ku_len,
  28. u_char * Kul, size_t * kul_len);
  29. NETSNMP_IMPORT
  30. int netsnmp_extend_kul(u_int needKeyLen, oid *hashoid, u_int hashoid_len,
  31. int privType, u_char *engineID, u_int engineIDLen,
  32. u_char **kulBuf, size_t *kulBufLen,
  33. u_int kulBufSize);
  34. NETSNMP_IMPORT
  35. int encode_keychange(const oid * hashtype,
  36. u_int hashtype_len, u_char * oldkey,
  37. size_t oldkey_len, u_char * newkey,
  38. size_t newkey_len, u_char * kcstring,
  39. size_t * kcstring_len);
  40. NETSNMP_IMPORT
  41. int decode_keychange(const oid *hashtype, u_int hashtype_len,
  42. const u_char *oldkey, size_t oldkey_len,
  43. const u_char *kcstring,
  44. size_t kcstring_len, u_char *newkey,
  45. size_t *newkey_len);
  46. /*
  47. * All functions devolve to the following block if we can't do cryptography
  48. */
  49. #define _KEYTOOLS_NOT_AVAILABLE \
  50. { \
  51. return SNMPERR_KT_NOT_AVAILABLE; \
  52. }
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif /* _KEYTOOLS_H */