pkcs11 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/Gemfile +16 -0
- data/History.txt +5 -0
- data/README.rdoc +37 -56
- data/Rakefile +23 -8
- data/appveyor.yml +38 -0
- data/ext/include/pkcs11.h +287 -299
- data/ext/include/pkcs11f.h +900 -912
- data/ext/include/pkcs11t.h +1917 -1885
- data/ext/pk11.c +7 -7
- data/ext/pk11_const.c +1 -1
- data/ext/pk11_const_def.inc +538 -451
- data/ext/pk11_struct.doc +163 -43
- data/ext/pk11_struct_def.inc +62 -18
- data/ext/pk11_struct_impl.inc +62 -18
- data/ext/pk11_version.h +1 -1
- data/lib/pkcs11/helper.rb +2 -1
- data/pkcs11_luna/Manifest.txt +24 -0
- data/pkcs11_luna/README_LUNA.rdoc +103 -0
- data/test/helper.rb +7 -1
- data/test/test_pkcs11_thread.rb +1 -2
- metadata +69 -50
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Manifest.txt +0 -57
- metadata.gz.sig +0 -0
data/ext/include/pkcs11f.h
CHANGED
@@ -1,912 +1,900 @@
|
|
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
|
-
CK_PKCS11_FUNCTION_INFO(
|
29
|
-
#ifdef CK_NEED_ARG_LIST
|
30
|
-
(
|
31
|
-
CK_VOID_PTR
|
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
|
-
CK_PKCS11_FUNCTION_INFO(
|
72
|
-
#ifdef CK_NEED_ARG_LIST
|
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
|
-
#endif
|
101
|
-
|
102
|
-
|
103
|
-
/*
|
104
|
-
* supported by a token. */
|
105
|
-
CK_PKCS11_FUNCTION_INFO(
|
106
|
-
#ifdef CK_NEED_ARG_LIST
|
107
|
-
(
|
108
|
-
CK_SLOT_ID slotID,
|
109
|
-
|
110
|
-
|
111
|
-
);
|
112
|
-
#endif
|
113
|
-
|
114
|
-
|
115
|
-
/*
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
(
|
120
|
-
CK_SLOT_ID
|
121
|
-
|
122
|
-
|
123
|
-
)
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
(
|
132
|
-
|
133
|
-
CK_UTF8CHAR_PTR
|
134
|
-
CK_ULONG
|
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
|
-
#endif
|
208
|
-
|
209
|
-
|
210
|
-
/*
|
211
|
-
* in a session. */
|
212
|
-
CK_PKCS11_FUNCTION_INFO(
|
213
|
-
#ifdef CK_NEED_ARG_LIST
|
214
|
-
(
|
215
|
-
CK_SESSION_HANDLE hSession,
|
216
|
-
CK_BYTE_PTR
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
);
|
233
|
-
#endif
|
234
|
-
|
235
|
-
|
236
|
-
/*
|
237
|
-
CK_PKCS11_FUNCTION_INFO(
|
238
|
-
#ifdef CK_NEED_ARG_LIST
|
239
|
-
(
|
240
|
-
CK_SESSION_HANDLE hSession
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
/*
|
249
|
-
CK_PKCS11_FUNCTION_INFO(
|
250
|
-
#ifdef CK_NEED_ARG_LIST
|
251
|
-
(
|
252
|
-
CK_SESSION_HANDLE hSession
|
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
|
-
CK_PKCS11_FUNCTION_INFO(
|
298
|
-
#ifdef CK_NEED_ARG_LIST
|
299
|
-
(
|
300
|
-
CK_SESSION_HANDLE hSession,
|
301
|
-
CK_OBJECT_HANDLE hObject,
|
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
|
-
CK_ATTRIBUTE_PTR pTemplate, /*
|
328
|
-
CK_ULONG ulCount /*
|
329
|
-
);
|
330
|
-
#endif
|
331
|
-
|
332
|
-
|
333
|
-
/*
|
334
|
-
* objects that match a template
|
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
|
-
CK_PKCS11_FUNCTION_INFO(
|
362
|
-
#ifdef CK_NEED_ARG_LIST
|
363
|
-
(
|
364
|
-
CK_SESSION_HANDLE hSession
|
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
|
-
CK_BYTE_PTR
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
(
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
CK_BYTE_PTR
|
405
|
-
CK_ULONG_PTR
|
406
|
-
);
|
407
|
-
#endif
|
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
|
-
CK_BYTE_PTR
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
(
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
CK_BYTE_PTR
|
455
|
-
CK_ULONG_PTR
|
456
|
-
);
|
457
|
-
#endif
|
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
|
-
CK_BYTE_PTR
|
493
|
-
|
494
|
-
);
|
495
|
-
#endif
|
496
|
-
|
497
|
-
|
498
|
-
/*
|
499
|
-
* operation
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
);
|
507
|
-
#endif
|
508
|
-
|
509
|
-
|
510
|
-
/*
|
511
|
-
* operation
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
);
|
519
|
-
#endif
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
(
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
*signature
|
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
|
-
CK_PKCS11_FUNCTION_INFO(
|
570
|
-
#ifdef CK_NEED_ARG_LIST
|
571
|
-
(
|
572
|
-
CK_SESSION_HANDLE hSession,
|
573
|
-
CK_BYTE_PTR
|
574
|
-
|
575
|
-
);
|
576
|
-
#endif
|
577
|
-
|
578
|
-
|
579
|
-
/*
|
580
|
-
*
|
581
|
-
CK_PKCS11_FUNCTION_INFO(
|
582
|
-
#ifdef CK_NEED_ARG_LIST
|
583
|
-
(
|
584
|
-
CK_SESSION_HANDLE hSession,
|
585
|
-
|
586
|
-
|
587
|
-
);
|
588
|
-
#endif
|
589
|
-
|
590
|
-
|
591
|
-
/*
|
592
|
-
*
|
593
|
-
CK_PKCS11_FUNCTION_INFO(
|
594
|
-
#ifdef CK_NEED_ARG_LIST
|
595
|
-
(
|
596
|
-
CK_SESSION_HANDLE hSession,
|
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
|
-
CK_PKCS11_FUNCTION_INFO(
|
652
|
-
#ifdef CK_NEED_ARG_LIST
|
653
|
-
(
|
654
|
-
CK_SESSION_HANDLE hSession,
|
655
|
-
CK_BYTE_PTR
|
656
|
-
CK_ULONG
|
657
|
-
);
|
658
|
-
#endif
|
659
|
-
|
660
|
-
|
661
|
-
/*
|
662
|
-
* operation,
|
663
|
-
CK_PKCS11_FUNCTION_INFO(
|
664
|
-
#ifdef CK_NEED_ARG_LIST
|
665
|
-
(
|
666
|
-
CK_SESSION_HANDLE hSession,
|
667
|
-
|
668
|
-
|
669
|
-
);
|
670
|
-
#endif
|
671
|
-
|
672
|
-
|
673
|
-
/*
|
674
|
-
* operation, where the data is recovered from the signature. */
|
675
|
-
CK_PKCS11_FUNCTION_INFO(
|
676
|
-
#ifdef CK_NEED_ARG_LIST
|
677
|
-
(
|
678
|
-
CK_SESSION_HANDLE hSession,
|
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
|
-
|
706
|
-
(
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
CK_BYTE_PTR pEncryptedPart, /*
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
(
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
CK_BYTE_PTR pPart, /*
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
(
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
CK_BYTE_PTR pEncryptedPart, /*
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
(
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
/*
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
*
|
782
|
-
|
783
|
-
*
|
784
|
-
|
785
|
-
|
786
|
-
* key
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
/*
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
/*
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
/*
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
/* Functions added in for Cryptoki Version 2.01 or later */
|
902
|
-
|
903
|
-
/* C_WaitForSlotEvent waits for a slot event (token insertion,
|
904
|
-
* removal, etc.) to occur. */
|
905
|
-
CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
|
906
|
-
#ifdef CK_NEED_ARG_LIST
|
907
|
-
(
|
908
|
-
CK_FLAGS flags, /* blocking/nonblocking flag */
|
909
|
-
CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */
|
910
|
-
CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */
|
911
|
-
);
|
912
|
-
#endif
|
1
|
+
/*
|
2
|
+
* Copyright (C) OASIS Open 2014. All rights reserved.
|
3
|
+
* OASIS trademark, IPR and other policies apply.
|
4
|
+
* http://www.oasis-open.org/policies-guidelines/ipr
|
5
|
+
*/
|
6
|
+
|
7
|
+
/* This header file contains pretty much everything about all the */
|
8
|
+
/* Cryptoki function prototypes. Because this information is */
|
9
|
+
/* used for more than just declaring function prototypes, the */
|
10
|
+
/* order of the functions appearing herein is important, and */
|
11
|
+
/* should not be altered. */
|
12
|
+
|
13
|
+
/* General-purpose */
|
14
|
+
|
15
|
+
/* C_Initialize initializes the Cryptoki library. */
|
16
|
+
CK_PKCS11_FUNCTION_INFO(C_Initialize)
|
17
|
+
#ifdef CK_NEED_ARG_LIST
|
18
|
+
(
|
19
|
+
CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets
|
20
|
+
* cast to CK_C_INITIALIZE_ARGS_PTR
|
21
|
+
* and dereferenced */
|
22
|
+
);
|
23
|
+
#endif
|
24
|
+
|
25
|
+
|
26
|
+
/* C_Finalize indicates that an application is done with the
|
27
|
+
* Cryptoki library. */
|
28
|
+
CK_PKCS11_FUNCTION_INFO(C_Finalize)
|
29
|
+
#ifdef CK_NEED_ARG_LIST
|
30
|
+
(
|
31
|
+
CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */
|
32
|
+
);
|
33
|
+
#endif
|
34
|
+
|
35
|
+
|
36
|
+
/* C_GetInfo returns general information about Cryptoki. */
|
37
|
+
CK_PKCS11_FUNCTION_INFO(C_GetInfo)
|
38
|
+
#ifdef CK_NEED_ARG_LIST
|
39
|
+
(
|
40
|
+
CK_INFO_PTR pInfo /* location that receives information */
|
41
|
+
);
|
42
|
+
#endif
|
43
|
+
|
44
|
+
|
45
|
+
/* C_GetFunctionList returns the function list. */
|
46
|
+
CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
|
47
|
+
#ifdef CK_NEED_ARG_LIST
|
48
|
+
(
|
49
|
+
CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to
|
50
|
+
* function list */
|
51
|
+
);
|
52
|
+
#endif
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
/* Slot and token management */
|
57
|
+
|
58
|
+
/* C_GetSlotList obtains a list of slots in the system. */
|
59
|
+
CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
|
60
|
+
#ifdef CK_NEED_ARG_LIST
|
61
|
+
(
|
62
|
+
CK_BBOOL tokenPresent, /* only slots with tokens? */
|
63
|
+
CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */
|
64
|
+
CK_ULONG_PTR pulCount /* receives number of slots */
|
65
|
+
);
|
66
|
+
#endif
|
67
|
+
|
68
|
+
|
69
|
+
/* C_GetSlotInfo obtains information about a particular slot in
|
70
|
+
* the system. */
|
71
|
+
CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
|
72
|
+
#ifdef CK_NEED_ARG_LIST
|
73
|
+
(
|
74
|
+
CK_SLOT_ID slotID, /* the ID of the slot */
|
75
|
+
CK_SLOT_INFO_PTR pInfo /* receives the slot information */
|
76
|
+
);
|
77
|
+
#endif
|
78
|
+
|
79
|
+
|
80
|
+
/* C_GetTokenInfo obtains information about a particular token
|
81
|
+
* in the system. */
|
82
|
+
CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
|
83
|
+
#ifdef CK_NEED_ARG_LIST
|
84
|
+
(
|
85
|
+
CK_SLOT_ID slotID, /* ID of the token's slot */
|
86
|
+
CK_TOKEN_INFO_PTR pInfo /* receives the token information */
|
87
|
+
);
|
88
|
+
#endif
|
89
|
+
|
90
|
+
|
91
|
+
/* C_GetMechanismList obtains a list of mechanism types
|
92
|
+
* supported by a token. */
|
93
|
+
CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
|
94
|
+
#ifdef CK_NEED_ARG_LIST
|
95
|
+
(
|
96
|
+
CK_SLOT_ID slotID, /* ID of token's slot */
|
97
|
+
CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */
|
98
|
+
CK_ULONG_PTR pulCount /* gets # of mechs. */
|
99
|
+
);
|
100
|
+
#endif
|
101
|
+
|
102
|
+
|
103
|
+
/* C_GetMechanismInfo obtains information about a particular
|
104
|
+
* mechanism possibly supported by a token. */
|
105
|
+
CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
|
106
|
+
#ifdef CK_NEED_ARG_LIST
|
107
|
+
(
|
108
|
+
CK_SLOT_ID slotID, /* ID of the token's slot */
|
109
|
+
CK_MECHANISM_TYPE type, /* type of mechanism */
|
110
|
+
CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */
|
111
|
+
);
|
112
|
+
#endif
|
113
|
+
|
114
|
+
|
115
|
+
/* C_InitToken initializes a token. */
|
116
|
+
CK_PKCS11_FUNCTION_INFO(C_InitToken)
|
117
|
+
#ifdef CK_NEED_ARG_LIST
|
118
|
+
/* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
|
119
|
+
(
|
120
|
+
CK_SLOT_ID slotID, /* ID of the token's slot */
|
121
|
+
CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */
|
122
|
+
CK_ULONG ulPinLen, /* length in bytes of the PIN */
|
123
|
+
CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */
|
124
|
+
);
|
125
|
+
#endif
|
126
|
+
|
127
|
+
|
128
|
+
/* C_InitPIN initializes the normal user's PIN. */
|
129
|
+
CK_PKCS11_FUNCTION_INFO(C_InitPIN)
|
130
|
+
#ifdef CK_NEED_ARG_LIST
|
131
|
+
(
|
132
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
133
|
+
CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */
|
134
|
+
CK_ULONG ulPinLen /* length in bytes of the PIN */
|
135
|
+
);
|
136
|
+
#endif
|
137
|
+
|
138
|
+
|
139
|
+
/* C_SetPIN modifies the PIN of the user who is logged in. */
|
140
|
+
CK_PKCS11_FUNCTION_INFO(C_SetPIN)
|
141
|
+
#ifdef CK_NEED_ARG_LIST
|
142
|
+
(
|
143
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
144
|
+
CK_UTF8CHAR_PTR pOldPin, /* the old PIN */
|
145
|
+
CK_ULONG ulOldLen, /* length of the old PIN */
|
146
|
+
CK_UTF8CHAR_PTR pNewPin, /* the new PIN */
|
147
|
+
CK_ULONG ulNewLen /* length of the new PIN */
|
148
|
+
);
|
149
|
+
#endif
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
/* Session management */
|
154
|
+
|
155
|
+
/* C_OpenSession opens a session between an application and a
|
156
|
+
* token. */
|
157
|
+
CK_PKCS11_FUNCTION_INFO(C_OpenSession)
|
158
|
+
#ifdef CK_NEED_ARG_LIST
|
159
|
+
(
|
160
|
+
CK_SLOT_ID slotID, /* the slot's ID */
|
161
|
+
CK_FLAGS flags, /* from CK_SESSION_INFO */
|
162
|
+
CK_VOID_PTR pApplication, /* passed to callback */
|
163
|
+
CK_NOTIFY Notify, /* callback function */
|
164
|
+
CK_SESSION_HANDLE_PTR phSession /* gets session handle */
|
165
|
+
);
|
166
|
+
#endif
|
167
|
+
|
168
|
+
|
169
|
+
/* C_CloseSession closes a session between an application and a
|
170
|
+
* token. */
|
171
|
+
CK_PKCS11_FUNCTION_INFO(C_CloseSession)
|
172
|
+
#ifdef CK_NEED_ARG_LIST
|
173
|
+
(
|
174
|
+
CK_SESSION_HANDLE hSession /* the session's handle */
|
175
|
+
);
|
176
|
+
#endif
|
177
|
+
|
178
|
+
|
179
|
+
/* C_CloseAllSessions closes all sessions with a token. */
|
180
|
+
CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
|
181
|
+
#ifdef CK_NEED_ARG_LIST
|
182
|
+
(
|
183
|
+
CK_SLOT_ID slotID /* the token's slot */
|
184
|
+
);
|
185
|
+
#endif
|
186
|
+
|
187
|
+
|
188
|
+
/* C_GetSessionInfo obtains information about the session. */
|
189
|
+
CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
|
190
|
+
#ifdef CK_NEED_ARG_LIST
|
191
|
+
(
|
192
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
193
|
+
CK_SESSION_INFO_PTR pInfo /* receives session info */
|
194
|
+
);
|
195
|
+
#endif
|
196
|
+
|
197
|
+
|
198
|
+
/* C_GetOperationState obtains the state of the cryptographic operation
|
199
|
+
* in a session. */
|
200
|
+
CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
|
201
|
+
#ifdef CK_NEED_ARG_LIST
|
202
|
+
(
|
203
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
204
|
+
CK_BYTE_PTR pOperationState, /* gets state */
|
205
|
+
CK_ULONG_PTR pulOperationStateLen /* gets state length */
|
206
|
+
);
|
207
|
+
#endif
|
208
|
+
|
209
|
+
|
210
|
+
/* C_SetOperationState restores the state of the cryptographic
|
211
|
+
* operation in a session. */
|
212
|
+
CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
|
213
|
+
#ifdef CK_NEED_ARG_LIST
|
214
|
+
(
|
215
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
216
|
+
CK_BYTE_PTR pOperationState, /* holds state */
|
217
|
+
CK_ULONG ulOperationStateLen, /* holds state length */
|
218
|
+
CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */
|
219
|
+
CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */
|
220
|
+
);
|
221
|
+
#endif
|
222
|
+
|
223
|
+
|
224
|
+
/* C_Login logs a user into a token. */
|
225
|
+
CK_PKCS11_FUNCTION_INFO(C_Login)
|
226
|
+
#ifdef CK_NEED_ARG_LIST
|
227
|
+
(
|
228
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
229
|
+
CK_USER_TYPE userType, /* the user type */
|
230
|
+
CK_UTF8CHAR_PTR pPin, /* the user's PIN */
|
231
|
+
CK_ULONG ulPinLen /* the length of the PIN */
|
232
|
+
);
|
233
|
+
#endif
|
234
|
+
|
235
|
+
|
236
|
+
/* C_Logout logs a user out from a token. */
|
237
|
+
CK_PKCS11_FUNCTION_INFO(C_Logout)
|
238
|
+
#ifdef CK_NEED_ARG_LIST
|
239
|
+
(
|
240
|
+
CK_SESSION_HANDLE hSession /* the session's handle */
|
241
|
+
);
|
242
|
+
#endif
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
/* Object management */
|
247
|
+
|
248
|
+
/* C_CreateObject creates a new object. */
|
249
|
+
CK_PKCS11_FUNCTION_INFO(C_CreateObject)
|
250
|
+
#ifdef CK_NEED_ARG_LIST
|
251
|
+
(
|
252
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
253
|
+
CK_ATTRIBUTE_PTR pTemplate, /* the object's template */
|
254
|
+
CK_ULONG ulCount, /* attributes in template */
|
255
|
+
CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */
|
256
|
+
);
|
257
|
+
#endif
|
258
|
+
|
259
|
+
|
260
|
+
/* C_CopyObject copies an object, creating a new object for the
|
261
|
+
* copy. */
|
262
|
+
CK_PKCS11_FUNCTION_INFO(C_CopyObject)
|
263
|
+
#ifdef CK_NEED_ARG_LIST
|
264
|
+
(
|
265
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
266
|
+
CK_OBJECT_HANDLE hObject, /* the object's handle */
|
267
|
+
CK_ATTRIBUTE_PTR pTemplate, /* template for new object */
|
268
|
+
CK_ULONG ulCount, /* attributes in template */
|
269
|
+
CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */
|
270
|
+
);
|
271
|
+
#endif
|
272
|
+
|
273
|
+
|
274
|
+
/* C_DestroyObject destroys an object. */
|
275
|
+
CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
|
276
|
+
#ifdef CK_NEED_ARG_LIST
|
277
|
+
(
|
278
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
279
|
+
CK_OBJECT_HANDLE hObject /* the object's handle */
|
280
|
+
);
|
281
|
+
#endif
|
282
|
+
|
283
|
+
|
284
|
+
/* C_GetObjectSize gets the size of an object in bytes. */
|
285
|
+
CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
|
286
|
+
#ifdef CK_NEED_ARG_LIST
|
287
|
+
(
|
288
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
289
|
+
CK_OBJECT_HANDLE hObject, /* the object's handle */
|
290
|
+
CK_ULONG_PTR pulSize /* receives size of object */
|
291
|
+
);
|
292
|
+
#endif
|
293
|
+
|
294
|
+
|
295
|
+
/* C_GetAttributeValue obtains the value of one or more object
|
296
|
+
* attributes. */
|
297
|
+
CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
|
298
|
+
#ifdef CK_NEED_ARG_LIST
|
299
|
+
(
|
300
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
301
|
+
CK_OBJECT_HANDLE hObject, /* the object's handle */
|
302
|
+
CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */
|
303
|
+
CK_ULONG ulCount /* attributes in template */
|
304
|
+
);
|
305
|
+
#endif
|
306
|
+
|
307
|
+
|
308
|
+
/* C_SetAttributeValue modifies the value of one or more object
|
309
|
+
* attributes */
|
310
|
+
CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
|
311
|
+
#ifdef CK_NEED_ARG_LIST
|
312
|
+
(
|
313
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
314
|
+
CK_OBJECT_HANDLE hObject, /* the object's handle */
|
315
|
+
CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */
|
316
|
+
CK_ULONG ulCount /* attributes in template */
|
317
|
+
);
|
318
|
+
#endif
|
319
|
+
|
320
|
+
|
321
|
+
/* C_FindObjectsInit initializes a search for token and session
|
322
|
+
* objects that match a template. */
|
323
|
+
CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
|
324
|
+
#ifdef CK_NEED_ARG_LIST
|
325
|
+
(
|
326
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
327
|
+
CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */
|
328
|
+
CK_ULONG ulCount /* attrs in search template */
|
329
|
+
);
|
330
|
+
#endif
|
331
|
+
|
332
|
+
|
333
|
+
/* C_FindObjects continues a search for token and session
|
334
|
+
* objects that match a template, obtaining additional object
|
335
|
+
* handles. */
|
336
|
+
CK_PKCS11_FUNCTION_INFO(C_FindObjects)
|
337
|
+
#ifdef CK_NEED_ARG_LIST
|
338
|
+
(
|
339
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
340
|
+
CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */
|
341
|
+
CK_ULONG ulMaxObjectCount, /* max handles to get */
|
342
|
+
CK_ULONG_PTR pulObjectCount /* actual # returned */
|
343
|
+
);
|
344
|
+
#endif
|
345
|
+
|
346
|
+
|
347
|
+
/* C_FindObjectsFinal finishes a search for token and session
|
348
|
+
* objects. */
|
349
|
+
CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
|
350
|
+
#ifdef CK_NEED_ARG_LIST
|
351
|
+
(
|
352
|
+
CK_SESSION_HANDLE hSession /* the session's handle */
|
353
|
+
);
|
354
|
+
#endif
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
/* Encryption and decryption */
|
359
|
+
|
360
|
+
/* C_EncryptInit initializes an encryption operation. */
|
361
|
+
CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
|
362
|
+
#ifdef CK_NEED_ARG_LIST
|
363
|
+
(
|
364
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
365
|
+
CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */
|
366
|
+
CK_OBJECT_HANDLE hKey /* handle of encryption key */
|
367
|
+
);
|
368
|
+
#endif
|
369
|
+
|
370
|
+
|
371
|
+
/* C_Encrypt encrypts single-part data. */
|
372
|
+
CK_PKCS11_FUNCTION_INFO(C_Encrypt)
|
373
|
+
#ifdef CK_NEED_ARG_LIST
|
374
|
+
(
|
375
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
376
|
+
CK_BYTE_PTR pData, /* the plaintext data */
|
377
|
+
CK_ULONG ulDataLen, /* bytes of plaintext */
|
378
|
+
CK_BYTE_PTR pEncryptedData, /* gets ciphertext */
|
379
|
+
CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */
|
380
|
+
);
|
381
|
+
#endif
|
382
|
+
|
383
|
+
|
384
|
+
/* C_EncryptUpdate continues a multiple-part encryption
|
385
|
+
* operation. */
|
386
|
+
CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
|
387
|
+
#ifdef CK_NEED_ARG_LIST
|
388
|
+
(
|
389
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
390
|
+
CK_BYTE_PTR pPart, /* the plaintext data */
|
391
|
+
CK_ULONG ulPartLen, /* plaintext data len */
|
392
|
+
CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
|
393
|
+
CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */
|
394
|
+
);
|
395
|
+
#endif
|
396
|
+
|
397
|
+
|
398
|
+
/* C_EncryptFinal finishes a multiple-part encryption
|
399
|
+
* operation. */
|
400
|
+
CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
|
401
|
+
#ifdef CK_NEED_ARG_LIST
|
402
|
+
(
|
403
|
+
CK_SESSION_HANDLE hSession, /* session handle */
|
404
|
+
CK_BYTE_PTR pLastEncryptedPart, /* last c-text */
|
405
|
+
CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */
|
406
|
+
);
|
407
|
+
#endif
|
408
|
+
|
409
|
+
|
410
|
+
/* C_DecryptInit initializes a decryption operation. */
|
411
|
+
CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
|
412
|
+
#ifdef CK_NEED_ARG_LIST
|
413
|
+
(
|
414
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
415
|
+
CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */
|
416
|
+
CK_OBJECT_HANDLE hKey /* handle of decryption key */
|
417
|
+
);
|
418
|
+
#endif
|
419
|
+
|
420
|
+
|
421
|
+
/* C_Decrypt decrypts encrypted data in a single part. */
|
422
|
+
CK_PKCS11_FUNCTION_INFO(C_Decrypt)
|
423
|
+
#ifdef CK_NEED_ARG_LIST
|
424
|
+
(
|
425
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
426
|
+
CK_BYTE_PTR pEncryptedData, /* ciphertext */
|
427
|
+
CK_ULONG ulEncryptedDataLen, /* ciphertext length */
|
428
|
+
CK_BYTE_PTR pData, /* gets plaintext */
|
429
|
+
CK_ULONG_PTR pulDataLen /* gets p-text size */
|
430
|
+
);
|
431
|
+
#endif
|
432
|
+
|
433
|
+
|
434
|
+
/* C_DecryptUpdate continues a multiple-part decryption
|
435
|
+
* operation. */
|
436
|
+
CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
|
437
|
+
#ifdef CK_NEED_ARG_LIST
|
438
|
+
(
|
439
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
440
|
+
CK_BYTE_PTR pEncryptedPart, /* encrypted data */
|
441
|
+
CK_ULONG ulEncryptedPartLen, /* input length */
|
442
|
+
CK_BYTE_PTR pPart, /* gets plaintext */
|
443
|
+
CK_ULONG_PTR pulPartLen /* p-text size */
|
444
|
+
);
|
445
|
+
#endif
|
446
|
+
|
447
|
+
|
448
|
+
/* C_DecryptFinal finishes a multiple-part decryption
|
449
|
+
* operation. */
|
450
|
+
CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
|
451
|
+
#ifdef CK_NEED_ARG_LIST
|
452
|
+
(
|
453
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
454
|
+
CK_BYTE_PTR pLastPart, /* gets plaintext */
|
455
|
+
CK_ULONG_PTR pulLastPartLen /* p-text size */
|
456
|
+
);
|
457
|
+
#endif
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
/* Message digesting */
|
462
|
+
|
463
|
+
/* C_DigestInit initializes a message-digesting operation. */
|
464
|
+
CK_PKCS11_FUNCTION_INFO(C_DigestInit)
|
465
|
+
#ifdef CK_NEED_ARG_LIST
|
466
|
+
(
|
467
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
468
|
+
CK_MECHANISM_PTR pMechanism /* the digesting mechanism */
|
469
|
+
);
|
470
|
+
#endif
|
471
|
+
|
472
|
+
|
473
|
+
/* C_Digest digests data in a single part. */
|
474
|
+
CK_PKCS11_FUNCTION_INFO(C_Digest)
|
475
|
+
#ifdef CK_NEED_ARG_LIST
|
476
|
+
(
|
477
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
478
|
+
CK_BYTE_PTR pData, /* data to be digested */
|
479
|
+
CK_ULONG ulDataLen, /* bytes of data to digest */
|
480
|
+
CK_BYTE_PTR pDigest, /* gets the message digest */
|
481
|
+
CK_ULONG_PTR pulDigestLen /* gets digest length */
|
482
|
+
);
|
483
|
+
#endif
|
484
|
+
|
485
|
+
|
486
|
+
/* C_DigestUpdate continues a multiple-part message-digesting
|
487
|
+
* operation. */
|
488
|
+
CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
|
489
|
+
#ifdef CK_NEED_ARG_LIST
|
490
|
+
(
|
491
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
492
|
+
CK_BYTE_PTR pPart, /* data to be digested */
|
493
|
+
CK_ULONG ulPartLen /* bytes of data to be digested */
|
494
|
+
);
|
495
|
+
#endif
|
496
|
+
|
497
|
+
|
498
|
+
/* C_DigestKey continues a multi-part message-digesting
|
499
|
+
* operation, by digesting the value of a secret key as part of
|
500
|
+
* the data already digested. */
|
501
|
+
CK_PKCS11_FUNCTION_INFO(C_DigestKey)
|
502
|
+
#ifdef CK_NEED_ARG_LIST
|
503
|
+
(
|
504
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
505
|
+
CK_OBJECT_HANDLE hKey /* secret key to digest */
|
506
|
+
);
|
507
|
+
#endif
|
508
|
+
|
509
|
+
|
510
|
+
/* C_DigestFinal finishes a multiple-part message-digesting
|
511
|
+
* operation. */
|
512
|
+
CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
|
513
|
+
#ifdef CK_NEED_ARG_LIST
|
514
|
+
(
|
515
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
516
|
+
CK_BYTE_PTR pDigest, /* gets the message digest */
|
517
|
+
CK_ULONG_PTR pulDigestLen /* gets byte count of digest */
|
518
|
+
);
|
519
|
+
#endif
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
/* Signing and MACing */
|
524
|
+
|
525
|
+
/* C_SignInit initializes a signature (private key encryption)
|
526
|
+
* operation, where the signature is (will be) an appendix to
|
527
|
+
* the data, and plaintext cannot be recovered from the
|
528
|
+
*signature. */
|
529
|
+
CK_PKCS11_FUNCTION_INFO(C_SignInit)
|
530
|
+
#ifdef CK_NEED_ARG_LIST
|
531
|
+
(
|
532
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
533
|
+
CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
|
534
|
+
CK_OBJECT_HANDLE hKey /* handle of signature key */
|
535
|
+
);
|
536
|
+
#endif
|
537
|
+
|
538
|
+
|
539
|
+
/* C_Sign signs (encrypts with private key) data in a single
|
540
|
+
* part, where the signature is (will be) an appendix to the
|
541
|
+
* data, and plaintext cannot be recovered from the signature. */
|
542
|
+
CK_PKCS11_FUNCTION_INFO(C_Sign)
|
543
|
+
#ifdef CK_NEED_ARG_LIST
|
544
|
+
(
|
545
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
546
|
+
CK_BYTE_PTR pData, /* the data to sign */
|
547
|
+
CK_ULONG ulDataLen, /* count of bytes to sign */
|
548
|
+
CK_BYTE_PTR pSignature, /* gets the signature */
|
549
|
+
CK_ULONG_PTR pulSignatureLen /* gets signature length */
|
550
|
+
);
|
551
|
+
#endif
|
552
|
+
|
553
|
+
|
554
|
+
/* C_SignUpdate continues a multiple-part signature operation,
|
555
|
+
* where the signature is (will be) an appendix to the data,
|
556
|
+
* and plaintext cannot be recovered from the signature. */
|
557
|
+
CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
|
558
|
+
#ifdef CK_NEED_ARG_LIST
|
559
|
+
(
|
560
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
561
|
+
CK_BYTE_PTR pPart, /* the data to sign */
|
562
|
+
CK_ULONG ulPartLen /* count of bytes to sign */
|
563
|
+
);
|
564
|
+
#endif
|
565
|
+
|
566
|
+
|
567
|
+
/* C_SignFinal finishes a multiple-part signature operation,
|
568
|
+
* returning the signature. */
|
569
|
+
CK_PKCS11_FUNCTION_INFO(C_SignFinal)
|
570
|
+
#ifdef CK_NEED_ARG_LIST
|
571
|
+
(
|
572
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
573
|
+
CK_BYTE_PTR pSignature, /* gets the signature */
|
574
|
+
CK_ULONG_PTR pulSignatureLen /* gets signature length */
|
575
|
+
);
|
576
|
+
#endif
|
577
|
+
|
578
|
+
|
579
|
+
/* C_SignRecoverInit initializes a signature operation, where
|
580
|
+
* the data can be recovered from the signature. */
|
581
|
+
CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
|
582
|
+
#ifdef CK_NEED_ARG_LIST
|
583
|
+
(
|
584
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
585
|
+
CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
|
586
|
+
CK_OBJECT_HANDLE hKey /* handle of the signature key */
|
587
|
+
);
|
588
|
+
#endif
|
589
|
+
|
590
|
+
|
591
|
+
/* C_SignRecover signs data in a single operation, where the
|
592
|
+
* data can be recovered from the signature. */
|
593
|
+
CK_PKCS11_FUNCTION_INFO(C_SignRecover)
|
594
|
+
#ifdef CK_NEED_ARG_LIST
|
595
|
+
(
|
596
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
597
|
+
CK_BYTE_PTR pData, /* the data to sign */
|
598
|
+
CK_ULONG ulDataLen, /* count of bytes to sign */
|
599
|
+
CK_BYTE_PTR pSignature, /* gets the signature */
|
600
|
+
CK_ULONG_PTR pulSignatureLen /* gets signature length */
|
601
|
+
);
|
602
|
+
#endif
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
/* Verifying signatures and MACs */
|
607
|
+
|
608
|
+
/* C_VerifyInit initializes a verification operation, where the
|
609
|
+
* signature is an appendix to the data, and plaintext cannot
|
610
|
+
* cannot be recovered from the signature (e.g. DSA). */
|
611
|
+
CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
|
612
|
+
#ifdef CK_NEED_ARG_LIST
|
613
|
+
(
|
614
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
615
|
+
CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
|
616
|
+
CK_OBJECT_HANDLE hKey /* verification key */
|
617
|
+
);
|
618
|
+
#endif
|
619
|
+
|
620
|
+
|
621
|
+
/* C_Verify verifies a signature in a single-part operation,
|
622
|
+
* where the signature is an appendix to the data, and plaintext
|
623
|
+
* cannot be recovered from the signature. */
|
624
|
+
CK_PKCS11_FUNCTION_INFO(C_Verify)
|
625
|
+
#ifdef CK_NEED_ARG_LIST
|
626
|
+
(
|
627
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
628
|
+
CK_BYTE_PTR pData, /* signed data */
|
629
|
+
CK_ULONG ulDataLen, /* length of signed data */
|
630
|
+
CK_BYTE_PTR pSignature, /* signature */
|
631
|
+
CK_ULONG ulSignatureLen /* signature length*/
|
632
|
+
);
|
633
|
+
#endif
|
634
|
+
|
635
|
+
|
636
|
+
/* C_VerifyUpdate continues a multiple-part verification
|
637
|
+
* operation, where the signature is an appendix to the data,
|
638
|
+
* and plaintext cannot be recovered from the signature. */
|
639
|
+
CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
|
640
|
+
#ifdef CK_NEED_ARG_LIST
|
641
|
+
(
|
642
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
643
|
+
CK_BYTE_PTR pPart, /* signed data */
|
644
|
+
CK_ULONG ulPartLen /* length of signed data */
|
645
|
+
);
|
646
|
+
#endif
|
647
|
+
|
648
|
+
|
649
|
+
/* C_VerifyFinal finishes a multiple-part verification
|
650
|
+
* operation, checking the signature. */
|
651
|
+
CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
|
652
|
+
#ifdef CK_NEED_ARG_LIST
|
653
|
+
(
|
654
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
655
|
+
CK_BYTE_PTR pSignature, /* signature to verify */
|
656
|
+
CK_ULONG ulSignatureLen /* signature length */
|
657
|
+
);
|
658
|
+
#endif
|
659
|
+
|
660
|
+
|
661
|
+
/* C_VerifyRecoverInit initializes a signature verification
|
662
|
+
* operation, where the data is recovered from the signature. */
|
663
|
+
CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
|
664
|
+
#ifdef CK_NEED_ARG_LIST
|
665
|
+
(
|
666
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
667
|
+
CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
|
668
|
+
CK_OBJECT_HANDLE hKey /* verification key */
|
669
|
+
);
|
670
|
+
#endif
|
671
|
+
|
672
|
+
|
673
|
+
/* C_VerifyRecover verifies a signature in a single-part
|
674
|
+
* operation, where the data is recovered from the signature. */
|
675
|
+
CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
|
676
|
+
#ifdef CK_NEED_ARG_LIST
|
677
|
+
(
|
678
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
679
|
+
CK_BYTE_PTR pSignature, /* signature to verify */
|
680
|
+
CK_ULONG ulSignatureLen, /* signature length */
|
681
|
+
CK_BYTE_PTR pData, /* gets signed data */
|
682
|
+
CK_ULONG_PTR pulDataLen /* gets signed data len */
|
683
|
+
);
|
684
|
+
#endif
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
/* Dual-function cryptographic operations */
|
689
|
+
|
690
|
+
/* C_DigestEncryptUpdate continues a multiple-part digesting
|
691
|
+
* and encryption operation. */
|
692
|
+
CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
|
693
|
+
#ifdef CK_NEED_ARG_LIST
|
694
|
+
(
|
695
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
696
|
+
CK_BYTE_PTR pPart, /* the plaintext data */
|
697
|
+
CK_ULONG ulPartLen, /* plaintext length */
|
698
|
+
CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
|
699
|
+
CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
|
700
|
+
);
|
701
|
+
#endif
|
702
|
+
|
703
|
+
|
704
|
+
/* C_DecryptDigestUpdate continues a multiple-part decryption and
|
705
|
+
* digesting operation. */
|
706
|
+
CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
|
707
|
+
#ifdef CK_NEED_ARG_LIST
|
708
|
+
(
|
709
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
710
|
+
CK_BYTE_PTR pEncryptedPart, /* ciphertext */
|
711
|
+
CK_ULONG ulEncryptedPartLen, /* ciphertext length */
|
712
|
+
CK_BYTE_PTR pPart, /* gets plaintext */
|
713
|
+
CK_ULONG_PTR pulPartLen /* gets plaintext len */
|
714
|
+
);
|
715
|
+
#endif
|
716
|
+
|
717
|
+
|
718
|
+
/* C_SignEncryptUpdate continues a multiple-part signing and
|
719
|
+
* encryption operation. */
|
720
|
+
CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)
|
721
|
+
#ifdef CK_NEED_ARG_LIST
|
722
|
+
(
|
723
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
724
|
+
CK_BYTE_PTR pPart, /* the plaintext data */
|
725
|
+
CK_ULONG ulPartLen, /* plaintext length */
|
726
|
+
CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
|
727
|
+
CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
|
728
|
+
);
|
729
|
+
#endif
|
730
|
+
|
731
|
+
|
732
|
+
/* C_DecryptVerifyUpdate continues a multiple-part decryption and
|
733
|
+
* verify operation. */
|
734
|
+
CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)
|
735
|
+
#ifdef CK_NEED_ARG_LIST
|
736
|
+
(
|
737
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
738
|
+
CK_BYTE_PTR pEncryptedPart, /* ciphertext */
|
739
|
+
CK_ULONG ulEncryptedPartLen, /* ciphertext length */
|
740
|
+
CK_BYTE_PTR pPart, /* gets plaintext */
|
741
|
+
CK_ULONG_PTR pulPartLen /* gets p-text length */
|
742
|
+
);
|
743
|
+
#endif
|
744
|
+
|
745
|
+
|
746
|
+
|
747
|
+
/* Key management */
|
748
|
+
|
749
|
+
/* C_GenerateKey generates a secret key, creating a new key
|
750
|
+
* object. */
|
751
|
+
CK_PKCS11_FUNCTION_INFO(C_GenerateKey)
|
752
|
+
#ifdef CK_NEED_ARG_LIST
|
753
|
+
(
|
754
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
755
|
+
CK_MECHANISM_PTR pMechanism, /* key generation mech. */
|
756
|
+
CK_ATTRIBUTE_PTR pTemplate, /* template for new key */
|
757
|
+
CK_ULONG ulCount, /* # of attrs in template */
|
758
|
+
CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */
|
759
|
+
);
|
760
|
+
#endif
|
761
|
+
|
762
|
+
|
763
|
+
/* C_GenerateKeyPair generates a public-key/private-key pair,
|
764
|
+
* creating new key objects. */
|
765
|
+
CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
|
766
|
+
#ifdef CK_NEED_ARG_LIST
|
767
|
+
(
|
768
|
+
CK_SESSION_HANDLE hSession, /* session
|
769
|
+
* handle */
|
770
|
+
CK_MECHANISM_PTR pMechanism, /* key-gen
|
771
|
+
* mech. */
|
772
|
+
CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template
|
773
|
+
* for pub.
|
774
|
+
* key */
|
775
|
+
CK_ULONG ulPublicKeyAttributeCount, /* # pub.
|
776
|
+
* attrs. */
|
777
|
+
CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template
|
778
|
+
* for priv.
|
779
|
+
* key */
|
780
|
+
CK_ULONG ulPrivateKeyAttributeCount, /* # priv.
|
781
|
+
* attrs. */
|
782
|
+
CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub.
|
783
|
+
* key
|
784
|
+
* handle */
|
785
|
+
CK_OBJECT_HANDLE_PTR phPrivateKey /* gets
|
786
|
+
* priv. key
|
787
|
+
* handle */
|
788
|
+
);
|
789
|
+
#endif
|
790
|
+
|
791
|
+
|
792
|
+
/* C_WrapKey wraps (i.e., encrypts) a key. */
|
793
|
+
CK_PKCS11_FUNCTION_INFO(C_WrapKey)
|
794
|
+
#ifdef CK_NEED_ARG_LIST
|
795
|
+
(
|
796
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
797
|
+
CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */
|
798
|
+
CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */
|
799
|
+
CK_OBJECT_HANDLE hKey, /* key to be wrapped */
|
800
|
+
CK_BYTE_PTR pWrappedKey, /* gets wrapped key */
|
801
|
+
CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */
|
802
|
+
);
|
803
|
+
#endif
|
804
|
+
|
805
|
+
|
806
|
+
/* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
|
807
|
+
* key object. */
|
808
|
+
CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)
|
809
|
+
#ifdef CK_NEED_ARG_LIST
|
810
|
+
(
|
811
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
812
|
+
CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */
|
813
|
+
CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */
|
814
|
+
CK_BYTE_PTR pWrappedKey, /* the wrapped key */
|
815
|
+
CK_ULONG ulWrappedKeyLen, /* wrapped key len */
|
816
|
+
CK_ATTRIBUTE_PTR pTemplate, /* new key template */
|
817
|
+
CK_ULONG ulAttributeCount, /* template length */
|
818
|
+
CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
|
819
|
+
);
|
820
|
+
#endif
|
821
|
+
|
822
|
+
|
823
|
+
/* C_DeriveKey derives a key from a base key, creating a new key
|
824
|
+
* object. */
|
825
|
+
CK_PKCS11_FUNCTION_INFO(C_DeriveKey)
|
826
|
+
#ifdef CK_NEED_ARG_LIST
|
827
|
+
(
|
828
|
+
CK_SESSION_HANDLE hSession, /* session's handle */
|
829
|
+
CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */
|
830
|
+
CK_OBJECT_HANDLE hBaseKey, /* base key */
|
831
|
+
CK_ATTRIBUTE_PTR pTemplate, /* new key template */
|
832
|
+
CK_ULONG ulAttributeCount, /* template length */
|
833
|
+
CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
|
834
|
+
);
|
835
|
+
#endif
|
836
|
+
|
837
|
+
|
838
|
+
|
839
|
+
/* Random number generation */
|
840
|
+
|
841
|
+
/* C_SeedRandom mixes additional seed material into the token's
|
842
|
+
* random number generator. */
|
843
|
+
CK_PKCS11_FUNCTION_INFO(C_SeedRandom)
|
844
|
+
#ifdef CK_NEED_ARG_LIST
|
845
|
+
(
|
846
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
847
|
+
CK_BYTE_PTR pSeed, /* the seed material */
|
848
|
+
CK_ULONG ulSeedLen /* length of seed material */
|
849
|
+
);
|
850
|
+
#endif
|
851
|
+
|
852
|
+
|
853
|
+
/* C_GenerateRandom generates random data. */
|
854
|
+
CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)
|
855
|
+
#ifdef CK_NEED_ARG_LIST
|
856
|
+
(
|
857
|
+
CK_SESSION_HANDLE hSession, /* the session's handle */
|
858
|
+
CK_BYTE_PTR RandomData, /* receives the random data */
|
859
|
+
CK_ULONG ulRandomLen /* # of bytes to generate */
|
860
|
+
);
|
861
|
+
#endif
|
862
|
+
|
863
|
+
|
864
|
+
|
865
|
+
/* Parallel function management */
|
866
|
+
|
867
|
+
/* C_GetFunctionStatus is a legacy function; it obtains an
|
868
|
+
* updated status of a function running in parallel with an
|
869
|
+
* application. */
|
870
|
+
CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)
|
871
|
+
#ifdef CK_NEED_ARG_LIST
|
872
|
+
(
|
873
|
+
CK_SESSION_HANDLE hSession /* the session's handle */
|
874
|
+
);
|
875
|
+
#endif
|
876
|
+
|
877
|
+
|
878
|
+
/* C_CancelFunction is a legacy function; it cancels a function
|
879
|
+
* running in parallel. */
|
880
|
+
CK_PKCS11_FUNCTION_INFO(C_CancelFunction)
|
881
|
+
#ifdef CK_NEED_ARG_LIST
|
882
|
+
(
|
883
|
+
CK_SESSION_HANDLE hSession /* the session's handle */
|
884
|
+
);
|
885
|
+
#endif
|
886
|
+
|
887
|
+
|
888
|
+
|
889
|
+
/* Functions added in for Cryptoki Version 2.01 or later */
|
890
|
+
|
891
|
+
/* C_WaitForSlotEvent waits for a slot event (token insertion,
|
892
|
+
* removal, etc.) to occur. */
|
893
|
+
CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
|
894
|
+
#ifdef CK_NEED_ARG_LIST
|
895
|
+
(
|
896
|
+
CK_FLAGS flags, /* blocking/nonblocking flag */
|
897
|
+
CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */
|
898
|
+
CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */
|
899
|
+
);
|
900
|
+
#endif
|