summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h
blob: a316efd37c754f988325501cc903b339e3276ba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// -*- C++ -*-

//=============================================================================
/**
 *  @file   SSLIOP_EVP_PKEY.h
 *
 *  $Id$
 *
 *  @author Ossama Othman <ossama@uci.edu>
 */
//=============================================================================

#ifndef TAO_SSLIOP_EVP_PKEY_H
#define TAO_SSLIOP_EVP_PKEY_H

#include /**/ "ace/pre.h"

#include "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/varbase.h"

#include <openssl/crypto.h>
#include <openssl/evp.h>

namespace TAO
{
  namespace SSLIOP
  {
    /**
     * @name CORBA-style Reference Count Manipulation Methods
     */
    /// Increase the reference count on the given EVP_PKEY structure.
    ::EVP_PKEY *_duplicate (::EVP_PKEY *key);

    /// Decrease the reference count on the given EVP_PKEY structure.
    void release (::EVP_PKEY *key);

    /**
     * @class EVP_PKEY_var
     *
     * @brief "_var" class for the OpenSSL @param EVP_PKEY structure.
     *
     * This class is simply used to make operations on instances of
     * the OpenSSL @param EVP_PKEY structures exception safe.  It is
     * only used internally by the SSLIOP pluggable protocol.
     */
    class EVP_PKEY_var : private TAO_Base_var
    {
    public:

      /**
       * @name Constructors
       */
      //@{
      EVP_PKEY_var (void);
      EVP_PKEY_var (::EVP_PKEY *x);
      EVP_PKEY_var (const EVP_PKEY_var &);
      //@}

      /// Destructor
      ~EVP_PKEY_var (void);

      EVP_PKEY_var &operator= (::EVP_PKEY *);
      EVP_PKEY_var &operator= (const EVP_PKEY_var &);
      const ::EVP_PKEY *operator-> (void) const;
      ::EVP_PKEY *operator-> (void);

      operator const ::EVP_PKEY &() const;
      operator ::EVP_PKEY &();

      ::EVP_PKEY *in (void) const;
      ::EVP_PKEY *&inout (void);
      ::EVP_PKEY *&out (void);
      ::EVP_PKEY *_retn (void);
      ::EVP_PKEY *ptr (void) const;

    private:

      // Unimplemented - prevents widening assignment.
      EVP_PKEY_var (const TAO_Base_var &rhs);
      EVP_PKEY_var &operator= (const TAO_Base_var &rhs);

    private:

      /// The OpenSSL @c EVP_PKEY structure that represents a private
      /// key.
      ::EVP_PKEY *evp_;

    };

  }  // End SSLIOP namespace.
}  // End TAO namespace.

#if defined (__ACE_INLINE__)
#include "SSLIOP_EVP_PKEY.inl"
#endif  /* __ACE_INLINE__ */

#include /**/ "ace/post.h"

#endif  /* TAO_SSLIOP_EVP_PKEY_H */