rucades 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +18 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +21 -0
- data/README.md +132 -0
- data/Rakefile +21 -0
- data/ext/rucades/cplib/Blob.h +192 -0
- data/ext/rucades/cplib/DateTime.h +518 -0
- data/ext/rucades/cplib/StringProxy.h +281 -0
- data/ext/rucades/cpstldll.h +183 -0
- data/ext/rucades/errormsg.cpp +561 -0
- data/ext/rucades/errormsg.h +31 -0
- data/ext/rucades/extconf.rb +91 -0
- data/ext/rucades/rucades.cpp +90 -0
- data/ext/rucades/rucades.h +14 -0
- data/ext/rucades/rucades_about.cpp +75 -0
- data/ext/rucades/rucades_about.h +26 -0
- data/ext/rucades/rucades_algorithm.cpp +54 -0
- data/ext/rucades/rucades_algorithm.h +28 -0
- data/ext/rucades/rucades_attribute.cpp +112 -0
- data/ext/rucades/rucades_attribute.h +30 -0
- data/ext/rucades/rucades_attributes.cpp +62 -0
- data/ext/rucades/rucades_attributes.h +28 -0
- data/ext/rucades/rucades_basic_constraints.cpp +67 -0
- data/ext/rucades/rucades_basic_constraints.h +27 -0
- data/ext/rucades/rucades_blobs.cpp +46 -0
- data/ext/rucades/rucades_blobs.h +25 -0
- data/ext/rucades/rucades_certificate.cpp +182 -0
- data/ext/rucades/rucades_certificate.h +59 -0
- data/ext/rucades/rucades_certificate_status.cpp +36 -0
- data/ext/rucades/rucades_certificate_status.h +23 -0
- data/ext/rucades/rucades_certificates.cpp +140 -0
- data/ext/rucades/rucades_certificates.h +31 -0
- data/ext/rucades/rucades_const.cpp +241 -0
- data/ext/rucades/rucades_crl.cpp +84 -0
- data/ext/rucades/rucades_crl.h +29 -0
- data/ext/rucades/rucades_eku.cpp +55 -0
- data/ext/rucades/rucades_eku.h +26 -0
- data/ext/rucades/rucades_ekus.cpp +43 -0
- data/ext/rucades/rucades_ekus.h +27 -0
- data/ext/rucades/rucades_encoded_data.cpp +41 -0
- data/ext/rucades/rucades_encoded_data.h +23 -0
- data/ext/rucades/rucades_enveloped_data.cpp +122 -0
- data/ext/rucades/rucades_enveloped_data.h +33 -0
- data/ext/rucades/rucades_extended_key_usage.cpp +53 -0
- data/ext/rucades/rucades_extended_key_usage.h +27 -0
- data/ext/rucades/rucades_hashed_data.cpp +90 -0
- data/ext/rucades/rucades_hashed_data.h +31 -0
- data/ext/rucades/rucades_key_usage.cpp +116 -0
- data/ext/rucades/rucades_key_usage.h +33 -0
- data/ext/rucades/rucades_oid.cpp +70 -0
- data/ext/rucades/rucades_oid.h +30 -0
- data/ext/rucades/rucades_private_key.cpp +86 -0
- data/ext/rucades/rucades_private_key.h +31 -0
- data/ext/rucades/rucades_public_key.cpp +59 -0
- data/ext/rucades/rucades_public_key.h +28 -0
- data/ext/rucades/rucades_raw_signature.cpp +42 -0
- data/ext/rucades/rucades_raw_signature.h +26 -0
- data/ext/rucades/rucades_recipients.cpp +63 -0
- data/ext/rucades/rucades_recipients.h +28 -0
- data/ext/rucades/rucades_signature_status.cpp +35 -0
- data/ext/rucades/rucades_signature_status.h +23 -0
- data/ext/rucades/rucades_signed_data.cpp +253 -0
- data/ext/rucades/rucades_signed_data.h +41 -0
- data/ext/rucades/rucades_signed_xml.cpp +87 -0
- data/ext/rucades/rucades_signed_xml.h +29 -0
- data/ext/rucades/rucades_signer.cpp +157 -0
- data/ext/rucades/rucades_signer.h +45 -0
- data/ext/rucades/rucades_signers.cpp +43 -0
- data/ext/rucades/rucades_signers.h +27 -0
- data/ext/rucades/rucades_store.cpp +78 -0
- data/ext/rucades/rucades_store.h +34 -0
- data/ext/rucades/rucades_symmetric_algorithm.cpp +107 -0
- data/ext/rucades/rucades_symmetric_algorithm.h +30 -0
- data/ext/rucades/rucades_tools.cpp +18 -0
- data/ext/rucades/rucades_version.cpp +60 -0
- data/ext/rucades/rucades_version.h +24 -0
- data/ext/rucades/stdafx.h +190 -0
- data/lib/rucades/version.rb +9 -0
- data/lib/rucades.rb +36 -0
- data/samples/encrypt_decrypt.rb +25 -0
- data/samples/sign_verify.rb +28 -0
- data/samples/sign_verify_hash.rb +30 -0
- data/samples/sign_verify_xml.rb +44 -0
- data/sig/rucades.rbs +4 -0
- metadata +156 -0
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright(C) 2004 ������ ���
|
|
3
|
+
*
|
|
4
|
+
* ���� ���� �������� ����������, ����������
|
|
5
|
+
* �������������� �������� ������ ���.
|
|
6
|
+
*
|
|
7
|
+
* ����� ����� ����� ����� �� ����� ���� �����������,
|
|
8
|
+
* ����������, ���������� �� ������ �����,
|
|
9
|
+
* ������������ ��� �������������� ����� ��������,
|
|
10
|
+
* ���������������, �������� �� ���� � ��� ��
|
|
11
|
+
* ����� ������������ ������� ��� ����������������
|
|
12
|
+
* ���������� ���������� � ��������� ������ ���.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*!
|
|
16
|
+
* \file $RCSfile$
|
|
17
|
+
* \version $Revision$
|
|
18
|
+
* \date $Date:: $
|
|
19
|
+
* \author $Author$
|
|
20
|
+
*
|
|
21
|
+
* \brief ����� ��� ������ �� ��������.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifndef _CPLIB_DATETIME_H_INCLUDED
|
|
25
|
+
#define _CPLIB_DATETIME_H_INCLUDED
|
|
26
|
+
|
|
27
|
+
#include <time.h>
|
|
28
|
+
#if !defined UNIX
|
|
29
|
+
# include <windows.h>
|
|
30
|
+
#endif /* !UNIX */
|
|
31
|
+
#include <cplib/StringProxy.h>
|
|
32
|
+
|
|
33
|
+
#ifdef UNIX
|
|
34
|
+
typedef long long LONGLONG;
|
|
35
|
+
#define Int32x32To64( a, b ) (LONGLONG)((LONGLONG)(ULONG)(a) * (ULONG)(b))
|
|
36
|
+
#define UInt32x32To64( a, b ) (LONGLONG)((LONGLONG)(ULONG)(a) * (ULONG)(b))
|
|
37
|
+
#endif //UNIX
|
|
38
|
+
|
|
39
|
+
namespace CryptoPro {
|
|
40
|
+
|
|
41
|
+
inline ULONG MyInt64Div32(ULONGLONG ll1, ULONG l2)
|
|
42
|
+
{
|
|
43
|
+
return static_cast<ULONG>(ll1 / l2);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
inline void ULongLongToLowHigh(ULONGLONG ll, DWORD &low, DWORD &high)
|
|
47
|
+
{
|
|
48
|
+
low = static_cast<DWORD>(ll);
|
|
49
|
+
high = static_cast<DWORD>(ll >> 32);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
inline ULONGLONG ULowHighToLongLong(DWORD low, DWORD high)
|
|
53
|
+
{
|
|
54
|
+
return static_cast<ULONGLONG>(((static_cast<ULONGLONG>(high)) << 32) + low);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
inline void time_tToFileTime( const time_t& src, DWORD& destHigh, DWORD& destLow)
|
|
58
|
+
{
|
|
59
|
+
ULONGLONG ll = Int32x32To64(src, 10000000) + 116444736000000000ULL;
|
|
60
|
+
ULongLongToLowHigh(ll,destLow,destHigh);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
inline void FileTimeTotime_t( time_t& dest, const unsigned int& srcHigh, const unsigned int& srcLow)
|
|
64
|
+
{
|
|
65
|
+
ULONGLONG ll = ULowHighToLongLong(srcLow,srcHigh);
|
|
66
|
+
dest=static_cast<time_t>(MyInt64Div32(ll - 116444736000000000ll, 10000000));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
inline tm FileTimeToTm(const FILETIME &ftime)
|
|
71
|
+
{
|
|
72
|
+
tm dest;
|
|
73
|
+
SYSTEMTIME time;
|
|
74
|
+
if(!::FileTimeToSystemTime(&ftime,&time))
|
|
75
|
+
throw;
|
|
76
|
+
dest.tm_year = time.wYear - 1900;
|
|
77
|
+
dest.tm_mon = time.wMonth - 1;
|
|
78
|
+
dest.tm_mday = time.wDay;
|
|
79
|
+
dest.tm_wday = time.wDayOfWeek;
|
|
80
|
+
dest.tm_hour = time.wHour;
|
|
81
|
+
dest.tm_min = time.wMinute;
|
|
82
|
+
dest.tm_sec = time.wSecond;
|
|
83
|
+
dest.tm_yday = 0;
|
|
84
|
+
dest.tm_isdst = 0;
|
|
85
|
+
return dest;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
class CPLIB_CLASS CDateTime;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* \class CDateTimeSpan DateTime.h <cplib/DateTime.h>
|
|
92
|
+
* \brief ������ �������.
|
|
93
|
+
*
|
|
94
|
+
* ����� ������ ������ ������� � ��������� �� �������������.
|
|
95
|
+
*
|
|
96
|
+
* \sa CDateTime
|
|
97
|
+
*/
|
|
98
|
+
class CPLIB_CLASS
|
|
99
|
+
CDateTimeSpan
|
|
100
|
+
{
|
|
101
|
+
public:
|
|
102
|
+
/// ������� ������ ������
|
|
103
|
+
explicit CDateTimeSpan();
|
|
104
|
+
/**
|
|
105
|
+
* \brief ������� � �������������� ������
|
|
106
|
+
*
|
|
107
|
+
* \param alya_generalizedTime [in] ��������� ������������� ������� �������
|
|
108
|
+
* \remarks ������ ���������� ������������� ���������: "YYYYMMDDhhmmss.ddddddZ"
|
|
109
|
+
* ��� YYYY - ����, MM - ������, DD - ���, hh - ����, mm - ������, ss - �������,
|
|
110
|
+
* dddddd - ���� ������� (�� 6-�� ������, ����� ������������� ������ � ��������������
|
|
111
|
+
* ������. �������: "00050600114530Z", "00000000000023.123Z", "00000000000003.123456Z"
|
|
112
|
+
*/
|
|
113
|
+
explicit CDateTimeSpan( const char* alya_generalizedTime);
|
|
114
|
+
/**
|
|
115
|
+
* \brief ������� � �������������� ������
|
|
116
|
+
*
|
|
117
|
+
* \param seconds [in] - ���������� ������ � ������� �������
|
|
118
|
+
* \param microseconds [in] - ���������� ����������� � ������� �������
|
|
119
|
+
*/
|
|
120
|
+
explicit CDateTimeSpan( unsigned seconds, unsigned microseconds = 0);
|
|
121
|
+
/**
|
|
122
|
+
* \brief ������� ����� ��������� �������.
|
|
123
|
+
*
|
|
124
|
+
* \param src [in] ������, ����� �������� ���������
|
|
125
|
+
*/
|
|
126
|
+
CDateTimeSpan( const CDateTimeSpan& src);
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* \brief ���������� ������ ������� � ��������� ������� (ANSI)
|
|
130
|
+
* \sa getGeneralizedTime(), towstring(), CDateTimeSpan()
|
|
131
|
+
*/
|
|
132
|
+
CStringProxy tostring() const;
|
|
133
|
+
/**
|
|
134
|
+
* \brief ���������� ������ ������� � ��������� ������� (Unicode)
|
|
135
|
+
* \sa getGeneralizedTime(), tostring(), CDateTimeSpan()
|
|
136
|
+
*/
|
|
137
|
+
CWStringProxy towstring() const;
|
|
138
|
+
/**
|
|
139
|
+
* \brief ���������� ������ ������� � ��������� ������� (ANSI)
|
|
140
|
+
* \sa tostring(), towstring(), CDateTimeSpan()
|
|
141
|
+
*/
|
|
142
|
+
CStringProxy getGeneralizedTime() const;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* \brief ���������� ������� ����� ���������� ����������
|
|
146
|
+
*/
|
|
147
|
+
DWORD getLowPart();
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* \brief ���������� ������� ����� ���������� ����������
|
|
151
|
+
*/
|
|
152
|
+
DWORD getHighPart();
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* \brief ������� ����� ��������� �������.
|
|
156
|
+
*
|
|
157
|
+
* \param src [in] ������, ����� �������� ���������
|
|
158
|
+
*/
|
|
159
|
+
CDateTimeSpan& operator=( const CDateTimeSpan& src);
|
|
160
|
+
/**
|
|
161
|
+
* \brief �������� ������ ��������.
|
|
162
|
+
*
|
|
163
|
+
* \param src [in] ������ ��� ������
|
|
164
|
+
* \remarks ������� �� ���������� ����������.
|
|
165
|
+
*/
|
|
166
|
+
void swap( CDateTimeSpan &src ) throw();
|
|
167
|
+
|
|
168
|
+
CPLIB_API friend bool operator==( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
169
|
+
CPLIB_API friend bool operator!=( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
170
|
+
CPLIB_API friend bool operator<=( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
171
|
+
CPLIB_API friend bool operator>=( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
172
|
+
CPLIB_API friend bool operator<( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
173
|
+
CPLIB_API friend bool operator>( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
174
|
+
CPLIB_API friend CDateTime& operator +=( CDateTime &lhs, const CDateTimeSpan& rhs);
|
|
175
|
+
CPLIB_API friend CDateTime& operator -=( CDateTime &lhs, const CDateTimeSpan& rhs);
|
|
176
|
+
CPLIB_API friend CDateTimeSpan& operator +=( CDateTimeSpan &lhs, const CDateTimeSpan& rhs);
|
|
177
|
+
CPLIB_API friend CDateTimeSpan& operator -=( CDateTimeSpan &lhs, const CDateTimeSpan& rhs);
|
|
178
|
+
CPLIB_API friend CDateTimeSpan operator -( const CDateTime &lhs, const CDateTime &rhs);
|
|
179
|
+
|
|
180
|
+
CPLIB_API friend CDateTimeSpan& operator *=( CDateTimeSpan &lhs, unsigned rhs);
|
|
181
|
+
CPLIB_API friend CDateTimeSpan& operator /=( CDateTimeSpan &lhs, unsigned rhs);
|
|
182
|
+
CPLIB_API friend CDateTimeSpan& operator %=( CDateTimeSpan &lhs, unsigned rhs);
|
|
183
|
+
|
|
184
|
+
CPLIB_API friend CDateTimeSpan operator *( const CDateTimeSpan &lhs, unsigned rhs);
|
|
185
|
+
CPLIB_API friend CDateTimeSpan operator /( const CDateTimeSpan &lhs, unsigned rhs);
|
|
186
|
+
CPLIB_API friend CDateTimeSpan operator %( const CDateTimeSpan &lhs, unsigned rhs);
|
|
187
|
+
|
|
188
|
+
CPLIB_API friend unsigned operator / (const CDateTimeSpan &lhs, const CDateTimeSpan &rhs);
|
|
189
|
+
CPLIB_API friend CDateTimeSpan operator % ( const CDateTimeSpan &lhs, const CDateTimeSpan &rhs );
|
|
190
|
+
|
|
191
|
+
static const CDateTimeSpan& OneYear();
|
|
192
|
+
static const CDateTimeSpan& OneMonth();
|
|
193
|
+
static const CDateTimeSpan& OneDay();
|
|
194
|
+
static const CDateTimeSpan& OneHour();
|
|
195
|
+
static const CDateTimeSpan& OneMinute();
|
|
196
|
+
static const CDateTimeSpan& OneSecond();
|
|
197
|
+
static const CDateTimeSpan& OneMillisecond();
|
|
198
|
+
|
|
199
|
+
private:
|
|
200
|
+
/// ������ ���� ��� (365 ����)
|
|
201
|
+
static const CDateTimeSpan oneYear;
|
|
202
|
+
/// ������ ���� ����� (30 ����)
|
|
203
|
+
static const CDateTimeSpan oneMonth;
|
|
204
|
+
/// ������ ���� ����
|
|
205
|
+
static const CDateTimeSpan oneDay;
|
|
206
|
+
/// ������ ���� ���
|
|
207
|
+
static const CDateTimeSpan oneHour;
|
|
208
|
+
/// ������ ���� ������
|
|
209
|
+
static const CDateTimeSpan oneMinute;
|
|
210
|
+
/// ������ ���� �������
|
|
211
|
+
static const CDateTimeSpan oneSecond;
|
|
212
|
+
/// ������ ���� ������������
|
|
213
|
+
static const CDateTimeSpan oneMillisecond;
|
|
214
|
+
|
|
215
|
+
DWORD high_;
|
|
216
|
+
DWORD low_;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* \class CDateTime DateTime.h <cplib/DateTime.h>
|
|
221
|
+
* \brief �����.
|
|
222
|
+
*
|
|
223
|
+
* ����� ������ �������� ������� � ��������� �� �������������.
|
|
224
|
+
*
|
|
225
|
+
* \sa CDateTimeSpan
|
|
226
|
+
*/
|
|
227
|
+
class CPLIB_CLASS
|
|
228
|
+
CDateTime
|
|
229
|
+
{
|
|
230
|
+
public:
|
|
231
|
+
/**
|
|
232
|
+
* \brief ������� � �������������� ������
|
|
233
|
+
*
|
|
234
|
+
* \param time [in] - ����� � ������� __time64_t
|
|
235
|
+
* \param micro [in] - ���������� �����������
|
|
236
|
+
*/
|
|
237
|
+
explicit CDateTime( long long time = 0, unsigned int micro = 0);
|
|
238
|
+
/**
|
|
239
|
+
* \brief ������� � �������������� ������
|
|
240
|
+
*
|
|
241
|
+
* \param generalizedTime [in] ��������� ������������� ������� �������
|
|
242
|
+
* \remarks ������ ���������� ������������� ���������: "YYYYMMDDhhmmss.ddddddZ"
|
|
243
|
+
* ��� YYYY - ����, MM - ������, DD - ���, hh - ����, mm - ������, ss - �������,
|
|
244
|
+
* dddddd - ���� ������� (�� 6-�� ������, ����� ������������� ������ � ��������������
|
|
245
|
+
* ������. �������: "20041105114530Z", "19940821101532.123Z", "19940821101532.123456Z"
|
|
246
|
+
*/
|
|
247
|
+
explicit CDateTime( const char* generalizedTime);
|
|
248
|
+
/**
|
|
249
|
+
* \brief ������� � �������������� ������
|
|
250
|
+
*
|
|
251
|
+
* \param time [in] - ����� � ������� __time32_t
|
|
252
|
+
* \param micro [in] - ���������� �����������
|
|
253
|
+
*/
|
|
254
|
+
CDateTime( long time, unsigned int micro);
|
|
255
|
+
/**
|
|
256
|
+
* \brief ������� � �������������� ������
|
|
257
|
+
*
|
|
258
|
+
* \param filetime [in] ����� � ������� FILETIME
|
|
259
|
+
*/
|
|
260
|
+
CDateTime( FILETIME filetime);
|
|
261
|
+
/**
|
|
262
|
+
* \brief ������� � �������������� ������
|
|
263
|
+
*
|
|
264
|
+
* \param systemtime [in] ����� � ������� SYSTEMTIME
|
|
265
|
+
*/
|
|
266
|
+
CDateTime( SYSTEMTIME systemtime);
|
|
267
|
+
/**
|
|
268
|
+
* \brief ������� � �������������� ������
|
|
269
|
+
*
|
|
270
|
+
* \param year [in] ���
|
|
271
|
+
* \param month [in] �����
|
|
272
|
+
* \param day [in] ����
|
|
273
|
+
* \param hour [in] ���
|
|
274
|
+
* \param minute [in] ������
|
|
275
|
+
* \param second [in] �������
|
|
276
|
+
* \param milli [in] ������������
|
|
277
|
+
* \param micro [in] ������������
|
|
278
|
+
*/
|
|
279
|
+
CDateTime(
|
|
280
|
+
unsigned int year,
|
|
281
|
+
unsigned int month,
|
|
282
|
+
unsigned int day,
|
|
283
|
+
unsigned int hour = 0,
|
|
284
|
+
unsigned int minute = 0,
|
|
285
|
+
unsigned int second = 0,
|
|
286
|
+
unsigned int milli = 0,
|
|
287
|
+
unsigned int micro = 0);
|
|
288
|
+
/**
|
|
289
|
+
* \brief ������� ����� ��������� �������.
|
|
290
|
+
*
|
|
291
|
+
* \param time [in] ������, ����� �������� ���������
|
|
292
|
+
*/
|
|
293
|
+
CDateTime( const CDateTime& time);
|
|
294
|
+
/**
|
|
295
|
+
* \brief ������� ����� ��������� �������.
|
|
296
|
+
*
|
|
297
|
+
* \param src [in] ������, ����� �������� ���������
|
|
298
|
+
*/
|
|
299
|
+
CDateTime& operator=( const CDateTime& src);
|
|
300
|
+
/**
|
|
301
|
+
* \brief �������� ������ ��������.
|
|
302
|
+
*
|
|
303
|
+
* \param src [in] ������ ��� ������
|
|
304
|
+
* \remarks ������� �� ���������� ����������.
|
|
305
|
+
*/
|
|
306
|
+
void swap( CDateTime &src ) throw();
|
|
307
|
+
|
|
308
|
+
/// ���������� ���
|
|
309
|
+
unsigned int year() const;
|
|
310
|
+
/// ���������� �����
|
|
311
|
+
unsigned int month() const;
|
|
312
|
+
/// ���������� ����
|
|
313
|
+
unsigned int day() const;
|
|
314
|
+
/// ���������� ���
|
|
315
|
+
unsigned int hour() const;
|
|
316
|
+
/// ���������� ������
|
|
317
|
+
unsigned int minute() const;
|
|
318
|
+
/// ���������� �������
|
|
319
|
+
unsigned int second() const;
|
|
320
|
+
/// ���������� ������������
|
|
321
|
+
unsigned int millisecond() const;
|
|
322
|
+
/// ���������� ������������
|
|
323
|
+
unsigned int microsecond() const;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* \brief ���������� ����� � ��������� ������� (ANSI)
|
|
327
|
+
* \sa getTime(), getFileTime(), getSystemTime(), tostring(), towstring(), CDateTimeSpan
|
|
328
|
+
*/
|
|
329
|
+
CStringProxy getGeneralizedTime() const;
|
|
330
|
+
CStringProxy getGeneralizedTimeTrimMicroseconds() const;
|
|
331
|
+
/**
|
|
332
|
+
* \brief ���������� ����� � ������� time_t
|
|
333
|
+
* \sa getGeneralizedTime(), getFileTime(), getSystemTime(), tostring(), towstring(), CDateTimeSpan
|
|
334
|
+
*/
|
|
335
|
+
time_t getTime() const;
|
|
336
|
+
/**
|
|
337
|
+
* \brief ���������� ����� � ������� FILETIME
|
|
338
|
+
* \sa getGeneralizedTime(), getTime(), getSystemTime(), tostring(), towstring(), CDateTimeSpan
|
|
339
|
+
*/
|
|
340
|
+
FILETIME getFileTime() const;
|
|
341
|
+
/**
|
|
342
|
+
* \brief ���������� ����� � ������� SYSTEMTIME
|
|
343
|
+
* \sa getGeneralizedTime(), getTime(), getFileTime(), tostring(), towstring(), CDateTimeSpan
|
|
344
|
+
*/
|
|
345
|
+
SYSTEMTIME getSystemTime() const;
|
|
346
|
+
/**
|
|
347
|
+
* \brief ���������� ����� � �������������� ��������� ������� (ANSI)
|
|
348
|
+
* \sa getGeneralizedTime(), getTime(), getFileTime(), getSystemTime(), towstring(), CDateTimeSpan
|
|
349
|
+
*/
|
|
350
|
+
CStringProxy tostring() const;
|
|
351
|
+
/**
|
|
352
|
+
* \brief ���������� ����� � �������������� ��������� ������� (Unicode)
|
|
353
|
+
* \sa getGeneralizedTime(), getTime(), getFileTime(), getSystemTime(), tostring(), CDateTimeSpan
|
|
354
|
+
*/
|
|
355
|
+
CWStringProxy towstring() const;
|
|
356
|
+
/**
|
|
357
|
+
* \brief ���������� �����, ��������������� � ���������� �������������
|
|
358
|
+
* \sa localToUtc()
|
|
359
|
+
*/
|
|
360
|
+
CDateTime utcToLocal() const;
|
|
361
|
+
/**
|
|
362
|
+
* \brief ���������� �����, ��������������� � ������������� � ������� �������������� ����������������� ������� (UTC)
|
|
363
|
+
* \sa utcToLocal()
|
|
364
|
+
*/
|
|
365
|
+
CDateTime localToUtc() const;
|
|
366
|
+
|
|
367
|
+
/// ���������� ������ � ������� �������� ������� � ��������� �� ������������ � ������� �������������� ����������������� ������� (UTC)
|
|
368
|
+
static CDateTime Now();
|
|
369
|
+
|
|
370
|
+
/// ���������� ������ � ������� �������� ������� � ��������� �� ������������ � ������� �������������� ����������������� ������� (UTC)
|
|
371
|
+
static CDateTime GetCurrentTime(){return Now();}
|
|
372
|
+
|
|
373
|
+
CPLIB_API friend bool operator==( const CDateTime& lhs, const CDateTime& rhs);
|
|
374
|
+
CPLIB_API friend bool operator!=( const CDateTime& lhs, const CDateTime& rhs);
|
|
375
|
+
CPLIB_API friend bool operator<=( const CDateTime& lhs, const CDateTime& rhs);
|
|
376
|
+
CPLIB_API friend bool operator>=( const CDateTime& lhs, const CDateTime& rhs);
|
|
377
|
+
CPLIB_API friend bool operator<( const CDateTime& lhs, const CDateTime& rhs);
|
|
378
|
+
CPLIB_API friend bool operator>( const CDateTime& lhs, const CDateTime& rhs);
|
|
379
|
+
CPLIB_API friend CDateTime& operator +=( CDateTime &lhs, const CDateTimeSpan& rhs);
|
|
380
|
+
CPLIB_API friend CDateTime& operator -=( CDateTime &lhs, const CDateTimeSpan& rhs);
|
|
381
|
+
CPLIB_API friend CDateTimeSpan operator -( const CDateTime &lhs, const CDateTime &rhs);
|
|
382
|
+
|
|
383
|
+
#ifdef UNIX
|
|
384
|
+
CDateTime( timeval tval);
|
|
385
|
+
timeval getTimeval() const;
|
|
386
|
+
#endif // UNIX
|
|
387
|
+
private:
|
|
388
|
+
DWORD high_;
|
|
389
|
+
DWORD low_;
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
/// �������� �������� �� ���������
|
|
393
|
+
CPLIB_API bool operator==( const CDateTime& lhs, const CDateTime& rhs);
|
|
394
|
+
/// �������� �������� �� �����������
|
|
395
|
+
CPLIB_API bool operator!=( const CDateTime& lhs, const CDateTime& rhs);
|
|
396
|
+
/// �������� ��������� (������ ��� �����)
|
|
397
|
+
CPLIB_API bool operator<=( const CDateTime& lhs, const CDateTime& rhs);
|
|
398
|
+
/// �������� ��������� (������ ��� �����)
|
|
399
|
+
CPLIB_API bool operator>=( const CDateTime& lhs, const CDateTime& rhs);
|
|
400
|
+
/// �������� ��������� (������)
|
|
401
|
+
CPLIB_API bool operator<( const CDateTime& lhs, const CDateTime& rhs);
|
|
402
|
+
/// �������� ��������� (������)
|
|
403
|
+
CPLIB_API bool operator>( const CDateTime& lhs, const CDateTime& rhs);
|
|
404
|
+
|
|
405
|
+
/// �������� �������� �� ���������
|
|
406
|
+
CPLIB_API bool operator==( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
407
|
+
/// �������� �������� �� �����������
|
|
408
|
+
CPLIB_API bool operator!=( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
409
|
+
/// �������� ��������� (������ ��� �����)
|
|
410
|
+
CPLIB_API bool operator<=( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
411
|
+
/// �������� ��������� (������ ��� �����)
|
|
412
|
+
CPLIB_API bool operator>=( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
413
|
+
/// �������� ��������� (������)
|
|
414
|
+
CPLIB_API bool operator<( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
415
|
+
/// �������� ��������� (������)
|
|
416
|
+
CPLIB_API bool operator>( const CDateTimeSpan& lhs, const CDateTimeSpan& rhs);
|
|
417
|
+
/// �������� ����������� ������� �� �������
|
|
418
|
+
CPLIB_API CDateTime& operator +=( CDateTime &lhs, const CDateTimeSpan& rhs);
|
|
419
|
+
/// �������� ��������� ������� �� �������
|
|
420
|
+
CPLIB_API CDateTime& operator -=( CDateTime &lhs, const CDateTimeSpan& rhs);
|
|
421
|
+
|
|
422
|
+
/// �������� ����������� ������� � �������
|
|
423
|
+
CPLIB_API CDateTimeSpan& operator +=( CDateTimeSpan &lhs, const CDateTimeSpan& rhs);
|
|
424
|
+
/**
|
|
425
|
+
* \brief �������� ��������� ������� �� �������
|
|
426
|
+
* \remark ������ ������� �� ����� ���� �������������. ���� � ����������
|
|
427
|
+
* ��������� ���������� ������������� ������, ������������ ����������.
|
|
428
|
+
*/
|
|
429
|
+
CPLIB_API CDateTimeSpan& operator -=( CDateTimeSpan &lhs, const CDateTimeSpan& rhs);
|
|
430
|
+
|
|
431
|
+
/// �������� ��������� ������� �� �����
|
|
432
|
+
CPLIB_API CDateTimeSpan& operator *=( CDateTimeSpan &lhs, unsigned rhs);
|
|
433
|
+
/// �������� ������� ������� �� �����
|
|
434
|
+
CPLIB_API CDateTimeSpan& operator /=( CDateTimeSpan &lhs, unsigned rhs);
|
|
435
|
+
/// �������� ��������� ������� �� ������� ������� �� �����
|
|
436
|
+
CPLIB_API CDateTimeSpan& operator %=( CDateTimeSpan &lhs, unsigned rhs);
|
|
437
|
+
|
|
438
|
+
/// �������� ��������� ������� �� �����
|
|
439
|
+
CPLIB_API CDateTimeSpan operator *( const CDateTimeSpan &lhs, unsigned rhs);
|
|
440
|
+
/// �������� ������� ������� �� �����
|
|
441
|
+
CPLIB_API CDateTimeSpan operator /( const CDateTimeSpan &lhs, unsigned rhs);
|
|
442
|
+
/// �������� ��������� ������� �� ������� ������� �� �����
|
|
443
|
+
CPLIB_API CDateTimeSpan operator %( const CDateTimeSpan &lhs, unsigned rhs);
|
|
444
|
+
|
|
445
|
+
/// �������� ������� ������� �� ������
|
|
446
|
+
CPLIB_API unsigned operator / ( const CDateTimeSpan &lhs, const CDateTimeSpan &rhs );
|
|
447
|
+
/// �������� ��������� ������� �� ������� ������� �� ������
|
|
448
|
+
CPLIB_API CDateTimeSpan operator % ( const CDateTimeSpan &lhs, const CDateTimeSpan &rhs );
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* \brief �������� ��������� ������� �� �������
|
|
452
|
+
* \remark ������ ������� �� ����� ���� �������������. ���� � ����������
|
|
453
|
+
* ��������� ���������� ������������� ������, ������������ ����������.
|
|
454
|
+
*/
|
|
455
|
+
CPLIB_API CDateTimeSpan operator -( const CDateTimeSpan &lhs, const CDateTimeSpan &rhs);
|
|
456
|
+
/**
|
|
457
|
+
* \brief �������� ��������� ������� �� �������
|
|
458
|
+
* \remark ������ ������� �� ����� ���� �������������. ��� ���������
|
|
459
|
+
* ����� �������� ������� ������� �� ����� ������� ������������ ����������
|
|
460
|
+
*/
|
|
461
|
+
CPLIB_API CDateTimeSpan operator -( const CDateTime &lhs, const CDateTime &rhs);
|
|
462
|
+
/// �������� ��������� ������� �� ����
|
|
463
|
+
CPLIB_API CDateTime operator -( const CDateTime &lhs, const CDateTimeSpan &rhs);
|
|
464
|
+
|
|
465
|
+
/// �������� ����������� ������� � �������
|
|
466
|
+
CPLIB_API CDateTimeSpan operator +( const CDateTimeSpan &lhs, const CDateTimeSpan &rhs);
|
|
467
|
+
/// �������� ����������� ������� �� �������
|
|
468
|
+
CPLIB_API CDateTime operator +( const CDateTime &lhs, const CDateTimeSpan &rhs);
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* \brief ������� ����������� � ���� ��������� ������� �������
|
|
472
|
+
*
|
|
473
|
+
* \param intervalUnit [in] ������� ��������� � ������� ������� ��������, ��������
|
|
474
|
+
* ��������� ����� ���� ������:
|
|
475
|
+
* - "s" - �������;
|
|
476
|
+
* - "n" - ������;
|
|
477
|
+
* - "h" - ����;
|
|
478
|
+
* - "d" - ���;
|
|
479
|
+
* - "w" - ������;
|
|
480
|
+
* - "m" - ������;
|
|
481
|
+
* - "y" - ����.
|
|
482
|
+
* \param interval [in] ������ ������������� ���������
|
|
483
|
+
* \param value [in] ����, � ������� ������������ ��������
|
|
484
|
+
*
|
|
485
|
+
* \return ����� �������� ����.
|
|
486
|
+
*/
|
|
487
|
+
CPLIB_API CDateTime DateAddA( const char* intervalUnit,
|
|
488
|
+
int interval, const CDateTime& value);
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* \brief ������� ����������� � ���� ��������� ������� �������
|
|
492
|
+
*
|
|
493
|
+
* \param intervalUnit [in] ������� ��������� � ������� ������� ��������, ��������
|
|
494
|
+
* ��������� ����� ���� ������:
|
|
495
|
+
* - "s" - �������;
|
|
496
|
+
* - "n" - ������;
|
|
497
|
+
* - "h" - ����;
|
|
498
|
+
* - "d" - ���;
|
|
499
|
+
* - "w" - ������;
|
|
500
|
+
* - "m" - ������;
|
|
501
|
+
* - "y" - ����.
|
|
502
|
+
* \param interval [in] ������ ������������� ���������
|
|
503
|
+
* \param value [in] ����, � ������� ������������ ��������
|
|
504
|
+
*
|
|
505
|
+
* \return ����� �������� ����.
|
|
506
|
+
*/
|
|
507
|
+
CPLIB_API CDateTime DateAddW( const wchar_t* intervalUnit,
|
|
508
|
+
int interval, const CDateTime& value);
|
|
509
|
+
|
|
510
|
+
#ifdef UNICODE
|
|
511
|
+
#define DateAdd DateAddW
|
|
512
|
+
#else
|
|
513
|
+
#define DateAdd DateAddA
|
|
514
|
+
#endif
|
|
515
|
+
|
|
516
|
+
} // namespace CryptoPro
|
|
517
|
+
|
|
518
|
+
#endif //_CPLIB_DATETIME_H_INCLUDED
|