~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/mod/sec/shl/Hkdf.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2011-03-16 21:31:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316213118-gk4k3ez3e5d2huna
Tags: 2.0.0-1
* QA upload.
* New upstream release
* Debian source format is 3.0 (quilt)
* Fix debhelper-but-no-misc-depends
* Fix ancient-standards-version
* Fix package-contains-linda-override
* debhelper compatibility is 7
* Fix dh-clean-k-is-deprecated

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ---------------------------------------------------------------------------
 
2
// - Hkdf.hpp                                                                -
 
3
// - afnix:sec module - hashed key derivation function class definition      -
 
4
// ---------------------------------------------------------------------------
 
5
// - This program is free software;  you can redistribute it  and/or  modify -
 
6
// - it provided that this copyright notice is kept intact.                  -
 
7
// -                                                                         -
 
8
// - This program  is  distributed in  the hope  that it will be useful, but -
 
9
// - without  any  warranty;  without  even   the   implied    warranty   of -
 
10
// - merchantability or fitness for a particular purpose.  In no event shall -
 
11
// - the copyright holder be liable for any  direct, indirect, incidental or -
 
12
// - special damages arising in any way out of the use of this software.     -
 
13
// ---------------------------------------------------------------------------
 
14
// - copyright (c) 1999-2011 amaury darsch                                   -
 
15
// ---------------------------------------------------------------------------
 
16
 
 
17
#ifndef  AFNIX_HKDF_HPP
 
18
#define  AFNIX_HKDF_HPP
 
19
 
 
20
#ifndef  AFNIX_KDF_HPP
 
21
#include "Kdf.hpp"
 
22
#endif
 
23
 
 
24
#ifndef  AFNIX_HASHER_HPP
 
25
#include "Hasher.hpp"
 
26
#endif
 
27
 
 
28
namespace afnix {
 
29
 
 
30
  /// The Hkdf class is an abstract class used to model key derivation
 
31
  /// function  based on hash function. The class maintains a hasher object
 
32
  /// that is used to derive the key from an octer string.
 
33
  /// @author amaury darsch
 
34
 
 
35
  class Hkdf : public Kdf {
 
36
  protected:
 
37
    /// the hasher object
 
38
    Hasher* p_hobj;
 
39
 
 
40
  public:
 
41
    /// create a hashed kdf object by hasher and size
 
42
    /// @param hobj the hasher object
 
43
    /// @param name the kdf name
 
44
    /// @param kbsz the key buffer size
 
45
    Hkdf (Hasher* hobj, const String& name, const long kbsz);
 
46
 
 
47
    /// destroy this hashed kdf object
 
48
    ~Hkdf (void);
 
49
 
 
50
    /// @return the class name
 
51
    String repr (void) const;
 
52
 
 
53
    /// reset this hkdf
 
54
    void reset (void);
 
55
 
 
56
    /// @return the hasher object
 
57
    virtual Hasher* gethobj (void) const;
 
58
 
 
59
  private:
 
60
    // make the copy constructor private
 
61
    Hkdf (const Hkdf&);
 
62
    // make the assignment operator private
 
63
    Hkdf& operator = (const Hkdf&);
 
64
 
 
65
  public:
 
66
    /// @return true if the given quark is defined
 
67
    bool isquark (const long quark, const bool hflg) const;
 
68
    
 
69
    /// apply this object with a set of arguments and a quark
 
70
    /// @param robj  the current runnable
 
71
    /// @param nset  the current nameset    
 
72
    /// @param quark the quark to apply these arguments
 
73
    /// @param argv  the arguments to apply
 
74
    Object* apply (Runnable* robj, Nameset* nset, const long quark,
 
75
                   Vector* argv);
 
76
  };
 
77
}
 
78
 
 
79
#endif