File: classWinCAPICryptoSymmetricKey.html

package info (click to toggle)
xml-security-c 1.2.1-3
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 24,464 kB
  • ctags: 6,673
  • sloc: cpp: 36,830; xml: 23,415; sh: 2,365; makefile: 340; perl: 221
file content (705 lines) | stat: -rw-r--r-- 35,054 bytes parent folder | download | duplicates (2)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>XML-Security-C: WinCAPICryptoSymmetricKey Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>WinCAPICryptoSymmetricKey Class Reference<br>
<small>
[<a class="el" href="group__wincapicrypto.html">Windows Crypto API Interface</a>]</small>
</h1><code>#include &lt;<a class="el" href="WinCAPICryptoSymmetricKey_8hpp-source.html">WinCAPICryptoSymmetricKey.hpp</a>&gt;</code>
<p>
Inheritance diagram for WinCAPICryptoSymmetricKey:<p><center><img src="classWinCAPICryptoSymmetricKey__inherit__graph.png" border="0" usemap="#WinCAPICryptoSymmetricKey__inherit__map" alt="Inheritance graph"></center>
<map name="WinCAPICryptoSymmetricKey__inherit__map">
<area href="classXSECCryptoSymmetricKey.html" shape="rect" coords="17,84,201,108" alt="">
<area href="classXSECCryptoKey.html" shape="rect" coords="48,9,170,33" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for WinCAPICryptoSymmetricKey:<p><center><img src="classWinCAPICryptoSymmetricKey__coll__graph.png" border="0" usemap="#WinCAPICryptoSymmetricKey__coll__map" alt="Collaboration graph"></center>
<map name="WinCAPICryptoSymmetricKey__coll__map">
<area href="classXSECCryptoSymmetricKey.html" shape="rect" coords="8,86,192,110" alt="">
<area href="classXSECCryptoKey.html" shape="rect" coords="38,9,161,33" alt="">
<area href="classsafeBuffer.html" shape="rect" coords="216,86,298,110" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classWinCAPICryptoSymmetricKey-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
Base interface definition for symmetric key material. 
<p>
This is the implementation for a wrapper of Windows CryptoAPI symmetric crypto functions. 
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Windows utility functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static HCRYPTKEY&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z143_0">createWindowsKey</a> (const unsigned char *key, unsigned int keyLen, <a class="el" href="classXSECCryptoSymmetricKey.html#w8">XSECCryptoSymmetricKey::SymmetricKeyType</a> type, HCRYPTPROV *prov)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a symmetric key from a octet string.  <a href="#z143_0"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Constructors and Destructors</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z140_0">WinCAPICryptoSymmetricKey</a> (HCRYPTPROV prov, <a class="el" href="classXSECCryptoSymmetricKey.html#w8">XSECCryptoSymmetricKey::SymmetricKeyType</a> type)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor.  <a href="#z140_0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z140_1">~WinCAPICryptoSymmetricKey</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor.  <a href="#z140_1"></a><br></td></tr>
<tr><td colspan="2"><div class="groupHeader">Basic CryptoKey Interface methods</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual const XMLCh *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z141_0">getProviderName</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns a string that identifies the crypto owner of this library.  <a href="#z141_0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classXSECCryptoKey.html">XSECCryptoKey</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z141_1">clone</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Clone the key.  <a href="#z141_1"></a><br></td></tr>
<tr><td colspan="2"><div class="groupHeader">Symmetric key interface methods</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classXSECCryptoSymmetricKey.html#w8">SymmetricKeyType</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z142_0">getSymmetricKeyType</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">What type of symmetric key is this?  <a href="#z142_0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z142_1">setKey</a> (const unsigned char *key, unsigned int keyLen)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the key from the provided bytes.  <a href="#z142_1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z142_2">decryptInit</a> (bool doPad=true, <a class="el" href="classXSECCryptoSymmetricKey.html#w9">SymmetricKeyMode</a> mode=MODE_CBC, const unsigned char *iv=NULL)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialise an decryption process.  <a href="#z142_2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z142_3">decrypt</a> (const unsigned char *inBuf, unsigned char *plainBuf, unsigned int inLength, unsigned int maxOutLength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Continue an decrypt operation using this key.  <a href="#z142_3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z142_4">decryptFinish</a> (unsigned char *plainBuf, unsigned int maxOutLength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Finish a decryption operation.  <a href="#z142_4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z142_5">encryptInit</a> (bool doPad=true, <a class="el" href="classXSECCryptoSymmetricKey.html#w9">SymmetricKeyMode</a> mode=MODE_CBC, const unsigned char *iv=NULL)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialise an encryption process.  <a href="#z142_5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z142_6">encrypt</a> (const unsigned char *inBuf, unsigned char *cipherBuf, unsigned int inLength, unsigned int maxOutLength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Continue an encryption operation using this key.  <a href="#z142_6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWinCAPICryptoSymmetricKey.html#z142_7">encryptFinish</a> (unsigned char *plainBuf, unsigned int maxOutLength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Finish a encryption operation.  <a href="#z142_7"></a><br></td></tr>
</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="z140_0" doxytag="WinCAPICryptoSymmetricKey::WinCAPICryptoSymmetricKey"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">WinCAPICryptoSymmetricKey::WinCAPICryptoSymmetricKey           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">HCRYPTPROV&nbsp;</td>
          <td class="mdname" nowrap> <em>prov</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap><a class="el" href="classXSECCryptoSymmetricKey.html#w8">XSECCryptoSymmetricKey::SymmetricKeyType</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>type</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Constructor. 
<p>
Can only construct a Symmetric key if we know what type it is<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>prov</em>&nbsp;</td><td>The appropriate provider that supports the required algorithm. Can be 0 if the app is going to pass in an octet via setKey, as the library will use its own internal key store and handle to CSP. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>type</em>&nbsp;</td><td>The type of key (i.e. algorithm) to create </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="z140_1" doxytag="WinCAPICryptoSymmetricKey::~WinCAPICryptoSymmetricKey"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual WinCAPICryptoSymmetricKey::~WinCAPICryptoSymmetricKey           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Destructor. 
<p>
Implementations must ensure that the held key is properly destroyed (overwritten) when key objects are deleted.     </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="z141_1" doxytag="WinCAPICryptoSymmetricKey::clone"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual <a class="el" href="classXSECCryptoKey.html">XSECCryptoKey</a>* WinCAPICryptoSymmetricKey::clone           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Clone the key. 
<p>
All keys need to be able to copy themselves and return a pointer to the copy. This allows the library to duplicate keys. 
<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z176_2">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<a class="anchor" name="z143_0" doxytag="WinCAPICryptoSymmetricKey::createWindowsKey"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">static HCRYPTKEY WinCAPICryptoSymmetricKey::createWindowsKey           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int&nbsp;</td>
          <td class="mdname" nowrap> <em>keyLen</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap><a class="el" href="classXSECCryptoSymmetricKey.html#w8">XSECCryptoSymmetricKey::SymmetricKeyType</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>type</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>HCRYPTPROV *&nbsp;</td>
          <td class="mdname" nowrap> <em>prov</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Create a symmetric key from a octet string. 
<p>
Uses the ApacheKeyStore to wrap an octet string in a public key and then load it into the Apache Key Container within the defined CSP<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>The buffer of bytes to load from </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>keyLen</em>&nbsp;</td><td>The number of bytes to load </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>type</em>&nbsp;</td><td>The key type to create from the bytes </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>prov</em>&nbsp;</td><td>If NULL, ignored. If non-null, but *prov == 0, the function will use an internal handle to a CSP and return the value in *prov. If *prov != 0, use contents of *prov as the provider to load the key into. NOTE - The provider <em>must</em> have a AT_KEYEXCHANGE key pair available. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>a pointer to the key or 0 on failure </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="z142_3" doxytag="WinCAPICryptoSymmetricKey::decrypt"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual unsigned int WinCAPICryptoSymmetricKey::decrypt           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>inBuf</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>plainBuf</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int&nbsp;</td>
          <td class="mdname" nowrap> <em>inLength</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int&nbsp;</td>
          <td class="mdname" nowrap> <em>maxOutLength</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Continue an decrypt operation using this key. 
<p>
Decryption must have been set up using an encryptInit call. Takes the inBuf and continues a decryption operation, writing the output to outBuf.<p>
This function does not have to guarantee that all input will be decrypted. In cases where the input is not a length of the block size, the implementation will need to hold back cipher-text to be handles during the next operation.<p>
<dl compact><dt><b>Note:</b></dt><dd>While maxOutLength is defined, the WinCAPI library will not read the value, so the onus is on the caller to ensure the buffer is long enough to hold the output!</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>inBuf</em>&nbsp;</td><td>Octets to be decrypted </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>plainBuf</em>&nbsp;</td><td>Buffer to place output in </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>inLength</em>&nbsp;</td><td>Number of bytes to decrypt </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>maxOutLength</em>&nbsp;</td><td>Maximum number of bytes to place in output buffer </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>Bytes placed in output Buffer </dd></dl>

<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z177_3">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<a class="anchor" name="z142_4" doxytag="WinCAPICryptoSymmetricKey::decryptFinish"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual unsigned int WinCAPICryptoSymmetricKey::decryptFinish           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>plainBuf</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int&nbsp;</td>
          <td class="mdname" nowrap> <em>maxOutLength</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Finish a decryption operation. 
<p>
Complete a decryption process. No cipher text is passed in, as this should simply be removing any remaining text from the plain storage buffer.<p>
May throw an exception if there is some stored cipher text that is not the length of the block size for block algorithms.<p>
<dl compact><dt><b>Note:</b></dt><dd>While maxOutLength is defined, the WinCAPI library will not read the value, so the onus is on the caller to ensure the buffer is long enough to hold the output!</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>plainBuf</em>&nbsp;</td><td>Buffer to place any remaining plain text in </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>maxOutLength</em>&nbsp;</td><td>Maximum number of bytes to pace in output </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>Bytes placed in output buffer </dd></dl>

<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z177_4">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<a class="anchor" name="z142_2" doxytag="WinCAPICryptoSymmetricKey::decryptInit"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool WinCAPICryptoSymmetricKey::decryptInit           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">bool&nbsp;</td>
          <td class="mdname" nowrap> <em>doPad</em> = <code>true</code>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap><a class="el" href="classXSECCryptoSymmetricKey.html#w9">SymmetricKeyMode</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>mode</em> = <code>MODE_CBC</code>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>const unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>iv</em> = <code>NULL</code></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Initialise an decryption process. 
<p>
Setup the key to get ready for a decryption session. Callers can pass in an IV. If one is not provided, but the algorithm requires one (e.g. 3DES_CBC), then implementations should assume that the start of the cipher text stream will in fact be the IV.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>doPad</em>&nbsp;</td><td>By default, we perform padding for last block </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>mode</em>&nbsp;</td><td>mode selection (Currently ECB or CBC mode only) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>iv</em>&nbsp;</td><td>Initialisation Vector to be used. NULL if one is not required, or if IV will be set from data stream </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>true if the initialisation succeeded. </dd></dl>

<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z177_2">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<a class="anchor" name="z142_6" doxytag="WinCAPICryptoSymmetricKey::encrypt"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual unsigned int WinCAPICryptoSymmetricKey::encrypt           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>inBuf</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>cipherBuf</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int&nbsp;</td>
          <td class="mdname" nowrap> <em>inLength</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int&nbsp;</td>
          <td class="mdname" nowrap> <em>maxOutLength</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Continue an encryption operation using this key. 
<p>
Encryption must have been set up using an encryptInit call. Takes the inBuf and continues a encryption operation, writing the output to outBuf.<p>
This function does not have to guarantee that all input will be encrypted. In cases where the input is not a length of the block size, the implementation will need to hold back plain-text to be handled during the next operation.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>inBuf</em>&nbsp;</td><td>Octets to be encrypted </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>cipherBuf</em>&nbsp;</td><td>Buffer to place output in </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>inLength</em>&nbsp;</td><td>Number of bytes to encrypt </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>maxOutLength</em>&nbsp;</td><td>Maximum number of bytes to place in output buffer </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>Bytes placed in output Buffer </dd></dl>

<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z177_6">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<a class="anchor" name="z142_7" doxytag="WinCAPICryptoSymmetricKey::encryptFinish"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual unsigned int WinCAPICryptoSymmetricKey::encryptFinish           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>plainBuf</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int&nbsp;</td>
          <td class="mdname" nowrap> <em>maxOutLength</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Finish a encryption operation. 
<p>
Complete a encryption process. No plain text is passed in, as this should simply be removing any remaining text from the plain storage buffer and creating a final padded block.<p>
Padding is performed by taking the remaining block, and setting the last byte to equal the number of bytes of padding. If the plain was an exact multiple of the block size, then an extra block of padding will be used. For example, if the block size is 8 bytes, and there were three remaining plain text bytes (0x01, 0x02 and 0x03), the final block will be :<p>
0x010203????????05<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>plainBuf</em>&nbsp;</td><td>Buffer to place final block of cipher text in </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>maxOutLength</em>&nbsp;</td><td>Maximum number of bytes to pace in output </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>Bytes placed in output buffer </dd></dl>

<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z177_7">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<a class="anchor" name="z142_5" doxytag="WinCAPICryptoSymmetricKey::encryptInit"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool WinCAPICryptoSymmetricKey::encryptInit           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">bool&nbsp;</td>
          <td class="mdname" nowrap> <em>doPad</em> = <code>true</code>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap><a class="el" href="classXSECCryptoSymmetricKey.html#w9">SymmetricKeyMode</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>mode</em> = <code>MODE_CBC</code>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>const unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>iv</em> = <code>NULL</code></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Initialise an encryption process. 
<p>
Setup the key to get ready for a decryption session. Callers can pass in an IV. If one is not provided, but the algorithm requires one (e.g. 3DES_CBC), then implementations are required to generate one.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>doPad</em>&nbsp;</td><td>By default, we perform padding for last block </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>mode</em>&nbsp;</td><td>What mode to handle blocks (Currently CBC or ECB) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>iv</em>&nbsp;</td><td>Initialisation Vector to be used. NULL if one is not required, or if IV is to be generated </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>true if the initialisation succeeded. </dd></dl>

<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z177_5">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<a class="anchor" name="z141_0" doxytag="WinCAPICryptoSymmetricKey::getProviderName"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual const XMLCh* WinCAPICryptoSymmetricKey::getProviderName           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns a string that identifies the crypto owner of this library. 
<p>

<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z176_1">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<a class="anchor" name="z142_0" doxytag="WinCAPICryptoSymmetricKey::getSymmetricKeyType"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="classXSECCryptoSymmetricKey.html#w8">SymmetricKeyType</a> WinCAPICryptoSymmetricKey::getSymmetricKeyType           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
What type of symmetric key is this? 
<p>
There are a number of different types of symmetric key. This method allows callers to determine the type of this particular key 
<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z177_0">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<a class="anchor" name="z142_1" doxytag="WinCAPICryptoSymmetricKey::setKey"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void WinCAPICryptoSymmetricKey::setKey           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const unsigned char *&nbsp;</td>
          <td class="mdname" nowrap> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>unsigned int&nbsp;</td>
          <td class="mdname" nowrap> <em>keyLen</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Set the key from the provided bytes. 
<p>
Symmetric keys can all be loaded from a buffer containing a series of bytes.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>The buffer containing the key bytes </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>keyLen</em>&nbsp;</td><td>The number of key bytes in the buffer </td></tr>
  </table>
</dl>

<p>
Implements <a class="el" href="classXSECCryptoSymmetricKey.html#z177_1">XSECCryptoSymmetricKey</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="WinCAPICryptoSymmetricKey_8hpp-source.html">WinCAPICryptoSymmetricKey.hpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Sun Jul 3 17:43:49 2005 for XML-Security-C by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>