net-snmp 5.7
keytools.h
00001 /*
00002  * keytools.h
00003  */
00004 
00005 #ifndef _KEYTOOLS_H
00006 #define _KEYTOOLS_H
00007 
00008 #ifdef __cplusplus
00009 extern          "C" {
00010 #endif
00011 
00012 
00013 #define USM_LENGTH_EXPANDED_PASSPHRASE  (1024 * 1024)   /* 1Meg. */
00014 
00015 #define USM_LENGTH_KU_HASHBLOCK         64      /* In bytes. */
00016 
00017 #define USM_LENGTH_P_MIN                8       /* In characters. */
00018     /*
00019      * Recommended practice given in <draft-ietf-snmpv3-usm-v2-02.txt>,
00020      * * Section 11.2 "Defining Users".  Move into cmdline app argument
00021      * * parsing, and out of the internal routine?  XXX
00022      */
00023 
00024     /*
00025      * Prototypes.h
00026      */
00027     NETSNMP_IMPORT
00028     int             generate_Ku(const oid * hashtype, u_int hashtype_len,
00029                                 const u_char * P, size_t pplen,
00030                                 u_char * Ku, size_t * kulen);
00031 
00032     NETSNMP_IMPORT
00033     int             generate_kul(const oid * hashtype, u_int hashtype_len,
00034                                  const u_char * engineID, size_t engineID_len,
00035                                  const u_char * Ku, size_t ku_len,
00036                                  u_char * Kul, size_t * kul_len);
00037 
00038     NETSNMP_IMPORT
00039     int             encode_keychange(const oid * hashtype,
00040                                      u_int hashtype_len, u_char * oldkey,
00041                                      size_t oldkey_len, u_char * newkey,
00042                                      size_t newkey_len, u_char * kcstring,
00043                                      size_t * kcstring_len);
00044 
00045     NETSNMP_IMPORT
00046     int             decode_keychange(const oid * hashtype,
00047                                      u_int hashtype_len, u_char * oldkey,
00048                                      size_t oldkey_len, u_char * kcstring,
00049                                      size_t kcstring_len, u_char * newkey,
00050                                      size_t * newkey_len);
00051 
00052 
00053     /*
00054      * All functions devolve to the following block if we can't do cryptography
00055      */
00056 #define _KEYTOOLS_NOT_AVAILABLE                 \
00057 {                                               \
00058         return SNMPERR_KT_NOT_AVAILABLE;        \
00059 }
00060 
00061 #ifdef __cplusplus
00062 }
00063 #endif
00064 #endif                          /* _KEYTOOLS_H */