Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.3 KiB

  1. // APriKey.cpp -- CAbstractPrivateKey implementation
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #include <algorithm>
  8. #include "cciPriKey.h"
  9. #include "cciCont.h"
  10. #include "AKeyPair.h"
  11. #include "TransactionWrap.h"
  12. #include "AContHelp.h"
  13. using namespace std;
  14. using namespace cci;
  15. /////////////////////////// LOCAL/HELPER /////////////////////////////////
  16. /////////////////////////// PUBLIC /////////////////////////////////
  17. // Types
  18. // C'tors/D'tors
  19. CAbstractPrivateKey::~CAbstractPrivateKey()
  20. {}
  21. // Operators
  22. bool
  23. CAbstractPrivateKey::operator==(CAbstractPrivateKey const &rhs) const
  24. {
  25. CTransactionWrap wrap(m_hcard);
  26. CTransactionWrap rhswrap(rhs.m_hcard);
  27. return CProtectableCrypt::operator==(rhs) &&
  28. DoEquals(rhs);
  29. }
  30. bool
  31. CAbstractPrivateKey::operator!=(CAbstractPrivateKey const &rhs) const
  32. {
  33. return !(*this == rhs);
  34. }
  35. // Operations
  36. void
  37. CAbstractPrivateKey::Delete()
  38. {
  39. CTransactionWrap wrap(m_hcard);
  40. // Remove any references to this object from the container
  41. vector<CContainer> vCont(m_hcard->EnumContainers());
  42. for_each(vCont.begin(), vCont.end(),
  43. EraseFromContainer<CPrivateKey, CAbstractKeyPair>(CPrivateKey(this),
  44. CAbstractKeyPair::PrivateKey,
  45. CAbstractKeyPair::PrivateKey));
  46. DoDelete();
  47. }
  48. void
  49. CAbstractPrivateKey::Value(CPrivateKeyBlob const &rblob)
  50. {
  51. CTransactionWrap wrap(m_hcard);
  52. DoWriteKey(rblob);
  53. }
  54. // Access
  55. // Predicates
  56. // Static Variables
  57. /////////////////////////// PROTECTED /////////////////////////////////
  58. // C'tors/D'tors
  59. CAbstractPrivateKey::CAbstractPrivateKey(CAbstractCard const &racard,
  60. ObjectAccess oa)
  61. : slbRefCnt::RCObject(),
  62. CProtectableCrypt(racard, oa)
  63. {}
  64. // Operators
  65. // Operations
  66. // Access
  67. // Predicates
  68. // Static Variables
  69. /////////////////////////// PRIVATE /////////////////////////////////
  70. // C'tors/D'tors
  71. // Operators
  72. // Operations
  73. // Access
  74. // Predicates
  75. // Static Variables