ROOT logo
// $Id: GKeyRSA.h 2088 2008-11-23 20:26:46Z matevz $

// Copyright (C) 1999-2008, Matevz Tadel. All rights reserved.
// This file is part of GLED, released under GNU General Public License version 2.
// For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.

#ifndef GledCore_GKeyRSA_H
#define GledCore_GKeyRSA_H

#include <Gled/GledTypes.h>
#include <Gled/GMutex.h>

class TBuffer;

typedef struct rsa_st RSA;

class GKeyRSA {

  friend class Gled;

private:
  static void init_ssl();
  static bool init_done;

  static GMutex*       s_ssl_mutexen;
  static void          ssl_locker_foo(int, int, const char*, int);
  static unsigned long ssl_id_foo();

  int			mSecretLen;
  unsigned char*	mSecret;

protected:

  Bool_t	bIsPrivate;	// X{G}

  RSA*		pKey;

  unsigned long mSslError;
  bool          check_error();
  const char*   error_string();

public:
  GKeyRSA();
  virtual ~GKeyRSA();

  void ReadPubKey(const char* file);
  void ReadPrivKey(const char* file);

  void GenerateSecret();
  void SendSecret(TBuffer& b);
  void ReceiveSecret(TBuffer& b);
  bool MatchSecrets(const GKeyRSA& a);

  void StreamPubKey(TBuffer& b);

#include "GKeyRSA.h7"
  ClassDef(GKeyRSA, 0);
}; // endclass GKeyRSA

#endif
 GKeyRSA.h:1
 GKeyRSA.h:2
 GKeyRSA.h:3
 GKeyRSA.h:4
 GKeyRSA.h:5
 GKeyRSA.h:6
 GKeyRSA.h:7
 GKeyRSA.h:8
 GKeyRSA.h:9
 GKeyRSA.h:10
 GKeyRSA.h:11
 GKeyRSA.h:12
 GKeyRSA.h:13
 GKeyRSA.h:14
 GKeyRSA.h:15
 GKeyRSA.h:16
 GKeyRSA.h:17
 GKeyRSA.h:18
 GKeyRSA.h:19
 GKeyRSA.h:20
 GKeyRSA.h:21
 GKeyRSA.h:22
 GKeyRSA.h:23
 GKeyRSA.h:24
 GKeyRSA.h:25
 GKeyRSA.h:26
 GKeyRSA.h:27
 GKeyRSA.h:28
 GKeyRSA.h:29
 GKeyRSA.h:30
 GKeyRSA.h:31
 GKeyRSA.h:32
 GKeyRSA.h:33
 GKeyRSA.h:34
 GKeyRSA.h:35
 GKeyRSA.h:36
 GKeyRSA.h:37
 GKeyRSA.h:38
 GKeyRSA.h:39
 GKeyRSA.h:40
 GKeyRSA.h:41
 GKeyRSA.h:42
 GKeyRSA.h:43
 GKeyRSA.h:44
 GKeyRSA.h:45
 GKeyRSA.h:46
 GKeyRSA.h:47
 GKeyRSA.h:48
 GKeyRSA.h:49
 GKeyRSA.h:50
 GKeyRSA.h:51
 GKeyRSA.h:52
 GKeyRSA.h:53
 GKeyRSA.h:54
 GKeyRSA.h:55
 GKeyRSA.h:56
 GKeyRSA.h:57
 GKeyRSA.h:58
 GKeyRSA.h:59
 GKeyRSA.h:60