forked from siemens/cmp-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmigration.robot
More file actions
1318 lines (1222 loc) · 76.1 KB
/
Copy pathmigration.robot
File metadata and controls
1318 lines (1222 loc) · 76.1 KB
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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
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
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
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SPDX-FileCopyrightText: Copyright 2024 Siemens AG
#
# SPDX-License-Identifier: Apache-2.0
*** Settings ***
Documentation Contains tests for hybrid signatures which are currently not part of the
... of active standards or just some additional hybrid signature draft mechanism test cases.
Resource ../resources/keywords.resource
Library Collections
Library OperatingSystem
Library ../resources/utils.py
Library ../resources/asn1utils.py
Library ../resources/cmputils.py
Library ../resources/keyutils.py
Library ../resources/certbuildutils.py
Library ../resources/protectionutils.py
Library ../resources/certextractutils.py
Library ../resources/checkutils.py
Library ../resources/extra_issuing_logic.py
Library ../resources/general_msg_utils.py
Library ../pq_logic/hybrid_issuing.py
Library ../pq_logic/hybrid_prepare.py
Library ../pq_logic/pq_verify_logic.py
Test Tags pqc mock-ca experimental hybrid
Suite Setup Setup Certs For Migration Tests
*** Variables ***
${uri_multiple_auth}= ${None}
${ISSUED_KEY}= ${None}
${ISSUED_CERT}= ${None}
${COMPOSITE_KEM_KEY}= ${None}
${COMPOSITE_KEM_CERT}= ${None}
${REVOKED_COMP_KEM_KEY}= ${None}
${REVOKED_COMP_KEM_CERT}= ${None}
${COMPOSITE_SIG_KEY}= ${None}
${COMPOSITE_SIG_CERT}= ${None}
${REVOKED_COMP_KEY}= ${None}
${REVOKED_COMP_CERT}= ${None}
${UPDATED_COMP_SIG_KEY}= ${None}
${UPDATED_COMP_SIG_CERT}= ${None}
${CHAMELEON_CERT}= ${None}
${CHAMELEON_KEY}= ${None}
${CHAMELEON_DELTA_CERT}= ${None}
${CHAMELEON_DELTA_KEY}= ${None}
${RELATED_CERT}= ${None}
${RELATED_KEY}= ${None}
${RELATED_CERT_SEC}= ${None}
${RELATED_KEY_SEC}= ${None}
${SUN_HYBRID_CERT}= ${None}
${SUN_HYBRID_KEY}= ${None}
${SUN_HYBRID_CERT_CHAIN}= ${None}
${SUN_HYBRID_CERT_REVOKED}= ${None}
${SUN_HYBRID_KEY_REVOKED}= ${None}
${SUN_HYBRID_REVOKED_CERT_CHAIN}= ${None}
*** Test Cases ***
###########################
# The tests are sorted by the different hybrid signature/issuing mechanisms,
# to clearly distinguish between the different mechanisms.
# The different between Catalyst-Signature and Catalyst-Issuing are the following:
#### Catalyst:
# - Catalyst-Issuing: The CA uses a different key for issuing, so that two keys can be authenticated,
# with a single request and a single certificate.
# - Catalyst-Signature: The CA uses a different signature algorithm for signing, so that two signature
# algorithms protect the same certificate.
# In this experimental tests has the client the option to ask for a specific signature algorithm.
##### Sun-Hybrid:
# - Also supports Hybrid KEM and Hybrid Signature Issuing.
# - The CA will only present the certificate in form1, if the certificate was correctly
# confirmed by the client, if a HybridKEM mechanism was used.
##### Hybrid-Authentication:
# Allows the user to use different mechanisms for authentication.
# Either allows alternative signatures inside the generalInfo field of the pkimessage,
# or allows a Composite Signature from two certificates.
##### Related-Cert:
# Allows the User to issue a related certificate.
# And adds the hash of the related certificate to the certificate.
##### Cert-Discovery:
# Allows the User to issue a related certificate.
# And adds the location and maybe the public key and/or signature algorithm
# inside the certificate.
##### Chameleon:
# Allows the User to issue a certificate with the POP described in the Related certificates,
# or by using a paired certificate.
###########################
##########################
# Catalyst Signature Tests
###########################
CA MUST issue a valid Catalyst Signed Certificate
[Documentation] When a Catalyst CA issues a certificate, the certificate must be valid
... and contains a signature with an alternative key.
[Tags] catalyst-sig
${key}= Generate Default Key
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${CATALYST_SIGNATURE}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=accepted
${cert}= Get Cert From PKIMessage ${response}
${cert_chain}= Build CMP Chain From PKIMessage ${response} for_issued_cert=True
Verify Catalyst Signature ${cert} ${cert_chain[1]}
CA MUST issue a valid Catalyst Signed Certificate with Wished Signature Algorithm
[Documentation] When a Catalyst CA issues a certificate, the certificate must be valid
... and contains a signature with an alternative key. When the signature algorithm
... is wished, the CA should use the wished signature algorithm.
[Tags] catalyst-sig hybrid-sig
${new_key}= Generate Default Key
${key}= Generate Key ml-dsa-87
${extension}= Prepare AltSignatureAlgorithm Extension key=${key} hash_alg=sha512
${extensions}= Create List ${extension}
${subject}= Get Next Common Name
${cert_template}= Prepare CertTemplate subject=${subject} extensions=${extensions} key=${new_key}
${ir}= Build Ir From Key ${new_key} cert_template=${cert_template}
... exclude_fields=senderKID,sender recipient=${RECIPIENT}
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} suffix=${CATALYST_SIGNATURE}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=accepted
${cert}= Get Cert From PKIMessage ${response}
${extensions}= Validate Catalyst Extensions cert=${cert} sig_alg_must_be=ml-dsa-87-sha512
${cert_chain}= Build CMP Chain From PKIMessage ${response} for_issued_cert=True
Verify Catalyst Signature ${cert} ${cert_chain[1]}
##########################
# Catalyst Issuing Tests
##########################
CA Could Support Valid 2 POP For Signing Keys
[Documentation] The Catalyst extension could be used to support two POPs for the signing keys.
... We send a certificate request, which contains two signing keys. The CA should
... issue a certificate, which contains the two signing keys.
[Tags] catalyst-issuing hybrid-sig
${key1}= Generate Default Key
${alt_key}= Generate Default PQ Sig Key
${cert_req_msg}= Prepare Catalyst CertReqMsg Approach ${key1} ${alt_key}
${ir}= Build Ir From Key ${key1} cert_req_msg=${cert_req_msg} recipient=${RECIPIENT}
... exclude_fields=senderKID,sender
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${CATALYST_ISSUING}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=accepted
${cert}= Get Cert From PKIMessage ${response}
${pub_key}= Load Catalyst Public Key ${cert}
Should Be Equal ${pub_key} ${alt_key.public_key()} The public key should be the same as the alternative key.
CA MUST Detect BadPOP For First POP
[Documentation] The Catalyst extension could be used to support two POPs for the signing keys.
... We send a certificate request, which contains two signing keys, but the first
... proof-of-possession is invalid. The CA should reject the request and MAY respond with the
... optional failInfo `badPOP`.
[Tags] catalyst-issuing
${key1}= Generate Default Key
${alt_key}= Generate Default PQ Sig Key
${cert_req_msg}= Prepare Catalyst CertReqMsg Approach ${key1} ${alt_key} bad_pop=True
${ir}= Build Ir From Key ${key1} cert_req_msg=${cert_req_msg}
... exclude_fields=senderKID,sender recipient=${RECIPIENT}
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${CATALYST_ISSUING}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} status=rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badPOP
CA Could Detect Invalid alternative POP
[Documentation] The Catalyst extension could be used to support two POPs for the signing keys.
... We send a certificate request, which contains two signing keys, but the alternative
... proof-of-possession is invalid. The CA should reject the request and MAY respond with the
... optional failInfo `badPOP`.
[Tags] catalyst-issuing
${key1}= Generate Default Key
${alt_key}= Generate Default PQ Sig Key
${cert_req_msg}= Prepare Catalyst CertReqMsg Approach ${key1} ${alt_key} bad_alt_pop=True
${ir}= Build Ir From Key ${key1} cert_req_msg=${cert_req_msg}
... exclude_fields=senderKID,sender recipient=${RECIPIENT}
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${CATALYST_ISSUING}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} status=rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badPOP
CA Could support Hybrid KEM issuing with Catalyst First Key being RSA and second key being KEM
[Documentation] The Catalyst extension could be used to support two keys issued in one certificate.
... We send a certificate request, which contains two keys. The first key is a signing key
... and the second key is a KEM-key. The CA should issue a certificate, which contains the two keys.
... The CA response should contain the encrypted certificate.
[Tags] catalyst-issuing positive
${key1}= Generate key rsa length=2048
${alt_key}= Generate Default PQ KEM Key
${cert_req_msg}= Prepare Catalyst CertReqMsg Approach ${key1} ${alt_key}
${ir}= Build Ir From Key ${None} cert_req_msg=${cert_req_msg}
... exclude_fields=senderKID,sender recipient=${RECIPIENT}
${protected_ir}= Default Protect PKIMessage ${ir}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${CATALYST_ISSUING}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=accepted
${cert}= Get EncCert From PKIMessage ${response} ee_private_key=${alt_key} exclude_rid_check=True
${pub_key}= Load Catalyst Public Key ${cert}
Should Be Equal ${pub_key} ${alt_key.public_key()} The public key should be the same as the alternative key.
CA Could support Hybrid KEM issuing with Catalyst First Key being KEM and second key being RSA
[Documentation] The Catalyst extension could be used to support two keys issued in one certificate.
... We send a certificate request, which contains two keys. The first key is a KEM-key
... and the second key is a signing key. The CA should issue a certificate, which contains the two
... keys. The CA response should contain the encrypted certificate.
[Tags] catalyst-issuing positive
${key1}= Generate Default PQ KEM Key
${alt_key}= Generate key rsa length=2048
${cert_req_msg}= Prepare Catalyst CertReqMsg Approach ${key1} ${alt_key}
${ir}= Build Ir From Key ${key1} cert_req_msg=${cert_req_msg}
... exclude_fields=senderKID,sender recipient=${RECIPIENT}
${protected_ir}= Default Protect PKIMessage ${ir}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${CATALYST_ISSUING}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=accepted
${cert}= Get EncCert From PKIMessage ${response} ee_private_key=${key1} exclude_rid_check=True
${pub_key}= Load Catalyst Public Key ${cert}
Should Be Equal ${pub_key} ${alt_key.public_key()} The public key should be the same as the alternative key.
CA Could Detect The Hybrid-KEM Catalyst Invalid POP
[Documentation] The Catalyst extension could be used to support two keys issued in one certificate.
... We send a certificate request, which contains two keys. The first key is a signing key
... and the second key is a KEM-key. The first key is invalid. The CA should reject the request
... and MAY respond with the optional failInfo `badPOP`.
[Tags] catalyst-issuing negative
${key1}= Generate Default Key
${alt_key}= Generate Default PQ KEM Key
${cert_req_msg}= Prepare Catalyst CertReqMsg Approach ${key1} ${alt_key} bad_pop=True
${ir}= Build Ir From Key ${key1} cert_req_msg=${cert_req_msg}
... exclude_fields=senderKID,sender recipient=${RECIPIENT}
${protected_ir}= Default Protect PKIMessage ${ir}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${CATALYST_ISSUING}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} status=rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badPOP
CA Could Detect The Hybrid-KEM Catalyst Invalid alternative POP
[Documentation] The Catalyst extension could be used to support two keys issued in one certificate.
... We send a certificate request, which contains two keys. The first key is a KEM key
... and the second key is RSA, but the alternative POP is invalid. The CA should reject
... the request and MAY respond with the optional failInfo `badPOP`.
[Tags] catalyst-issuing negative
${key1}= Generate Default PQ KEM Key
${alt_key}= Generate Default Key
${cert_req_msg}= Prepare Catalyst CertReqMsg Approach ${key1} ${alt_key} bad_alt_pop=True
${ir}= Build Ir From Key ${key1} cert_req_msg=${cert_req_msg}
... exclude_fields=senderKID,sender recipient=${RECIPIENT}
${protected_ir}= Default Protect PKIMessage ${ir}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${CATALYST_ISSUING}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} status=rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badPOP
##########################
# Sun-Hybrid Tests
##########################
CA MUST Include the Sun-Hybrid Extensions
[Documentation] According to draft-sun-lamps-hybrid-scheme-00 is a valid composite signature CSR send
... to the CA. The CA should process the valid CSR and issue a valid certificate.
... The CA MUST include the Sun-Hybrid extensions in the certificate.
[Tags] sun-hybrid hybrid-sig positive
${key}= Generate Key composite-sig
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender
... implicit_confirm=${ALLOW_IMPLICIT_CONFIRM}
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${ir} ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
PKIMessage Body Type Must Be ${response} ip
${cert}= Get Cert From PKIMessage ${response}
Validate Cert Contains Sun Hybrid Extensions ${cert}
CA MUST Issue Sun Hybrid Non-Critical Extensions
[Documentation] According to draft-sun-lamps-hybrid-scheme-00 is a valid composite signature CSR send
... to the CA. The CA should process the valid CSR and issue a valid certificate.
... The CA should include the Sun-Hybrid extensions in the certificate.
[Tags] sun-hybrid hybrid-sig
${key}= Generate Key composite-sig
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender
... implicit_confirm=${ALLOW_IMPLICIT_CONFIRM}
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${ir} ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=accepted
${cert}= Get Cert From PKIMessage ${response}
Extension Must Be Non Critical ${cert} sun_hybrid_alt_pubkey
Extension Must Be Non Critical ${cert} sun_hybrid_alt_sig
CA MUST Issue a Valid Sun Hybrid Certificate
[Documentation] According to draft-sun-lamps-hybrid-scheme-00 is a valid composite signature CSR send
... to the CA. The CA should process the valid CSR and issue a valid certificate.
[Tags] sun-hybrid hybrid-sig
${key}= Generate Unique Key composite-sig
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender recipient=${RECIPIENT}
... implicit_confirm=${ALLOW_IMPLICIT_CONFIRM}
${protected_ir}= Default Protect PKIMessage ${ir}
${response}= Exchange Migration PKIMessage ${ir} ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=accepted
${cert}= Get Cert From PKIMessage ${response}
${issuer_cert}= Find Sun Hybrid Issuer Cert ${cert} ${response["extraCerts"]}
Verify Sun Hybrid Cert ${cert} ${issuer_cert}
CA MUST Send the Certificate in Form 1 or 3 as well
[Documentation] According to draft-sun-lamps-hybrid-scheme-00 is a valid composite signature CSR send
... to the CA. The CA should process the valid CSR and issue a valid certificate.
... The CA should send the certificate in form 1 or 3 as well, so that the has the original
... alternative signature.
[Tags] sun-hybrid hybrid-sig
${response}= Exchange Composite Request ${SUN_HYBRID_SUFFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} accepted
${cert}= Get Cert From PKIMessage ${response}
Contains Sun Hybrid Cert Form 1 Or 3 ${cert} ${response["extraCerts"]}
CA MUST Support Sun Hybrid Valid Certificate Confirmation
[Documentation] According to draft-sun-lamps-hybrid-scheme-00 is a valid composite signature CSR send
... to the CA. The CA should process the valid CSR and issue a valid certificate.
... The CA should support the Sun-Hybrid confirmation mechanism.
[Tags] sun-hybrid hybrid-sig
${key}= Generate Key composite-sig
${url}= Add URL Suffix ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender
... recipient=${RECIPIENT}
${protected_ir}= Default Protect PKIMessage ${ir}
${response}= Exchange PKIMessage ${protected_ir} ${url}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} accepted
${cert}= Get Cert From PKIMessage ${response}
${cert_chain}= Build Sun Hybrid Cert Chain ${cert} ${response["extraCerts"]}
Write Certs To Dir ${cert_chain}
${cert_conf}= Build Cert Conf From Resp ${response} recipient=${RECIPIENT} exclude_fields=sender,senderKID
${prot_cert_conf}= Default Protect PKIMessage ${cert_conf}
${response}= Exchange Migration PKIMessage ${prot_cert_conf} ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
PKIMessage Body Type Must Be ${response} pkiconf
VAR ${SUN_HYBRID_CERT_CHAIN}= ${cert_chain} scope=Global
VAR ${SUN_HYBRID_CERT}= ${cert} scope=Global
VAR ${SUN_HYBRID_KEY}= ${key} scope=Global
CA MUST Revoked a Valid Sun Hybrid Certificate
[Documentation] According to draft-sun-lamps-hybrid-scheme-00 is a valid composite signature CSR send
... to the CA. The CA should process the valid CSR and issue a valid certificate.
... The CA should revoke the certificate.
[Tags] sun-hybrid hybrid-sig
${key}= Generate Unique Key composite-sig
${response}= Exchange Composite Request ${SUN_HYBRID_SUFFIX} ${key}
${url}= Add URL Suffix ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
${cert}= Confirm Certificate If Needed ${response} url=${url}
${cert_chain}= Build Sun Hybrid Cert Chain ${cert} ${response["extraCerts"]}
${rr}= Build CMP Revoke Request ${cert} recipient=${RECIPIENT}
${protected_rr}= Protect Hybrid PKIMessage
... ${rr}
... protection=signature
... private_key=${key.trad_key}
... cert=${cert}
${protected_ir}= Patch ExtraCerts ${protected_rr} ${cert_chain}
${response}= Exchange Migration PKIMessage ${protected_rr} ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
PKIMessage Body Type Must Be ${response} rp
PKIStatus Must Be ${response} status=accepted
VAR ${SUN_HYBRID_REVOKED_CERT_CHAIN}= ${cert_chain} scope=Global
VAR ${SUN_HYBRID_CERT_REVOKED}= ${cert} scope=Global
VAR ${SUN_HYBRID_KEY_REVOKED}= ${key} scope=Global
CA MUST Reject Request With Revoked Sun Hybrid Request
[Documentation] According to draft-sun-lamps-hybrid-scheme-00 is a valid composite signature CSR send
... to the CA. We send a certificate request, which is signed with a revoked hybrid sun
... certificate and key. The CA should reject the request and MAY respond with the optional
... failInfo `certRevoked`.
[Tags] sun-hybrid hybrid-sig
${result}= Is Certificate And Key Set ${SUN_HYBRID_CERT_REVOKED} ${SUN_HYBRID_KEY_REVOKED} for_sun_hybrid=True
SKIP IF not ${result} The Sun Hybrid Certificate and Key are not set.
${key}= Generate Key composite-sig
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender recipient=${RECIPIENT}
${protected_ir}= Protect Hybrid PKIMessage
... ${ir}
... protection=composite
... private_key=${SUN_HYBRID_KEY_REVOKED}
... cert=${SUN_HYBRID_CERT_REVOKED}
${protected_ir}= Patch ExtraCerts ${protected_ir} ${SUN_HYBRID_REVOKED_CERT_CHAIN}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
PKIStatus Must Be ${response} status=rejection
PKIStatusInfo Failinfo Bit Must Be ${response} certRevoked
CA MUST Update a Sun Hybrid Certificate
[Documentation] According to draft-sun-lamps-hybrid-scheme-00 is a valid composite signature CSR send
... to the CA. The CA should process the valid CSR and issue a valid certificate.
... The CA should update the certificate.
[Tags] sun-hybrid hybrid-sig
${key}= Generate Key composite-sig
${response}= Exchange Composite Request ${SUN_HYBRID_SUFFIX} ${key} True
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} accepted
${url}= Add URL Suffix ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
${cert}= Confirm Certificate If Needed ${response} url=${url}
${new_key}= Generate Key composite-sig
${kur}= Build Key Update Request ${new_key} ${cert}
... exclude_fields=senderKID,sender recipient=${RECIPIENT}
${protected_kur}= Protect Hybrid PKIMessage
... ${kur}
... protection=composite
... private_key=${key}
... cert=${cert}
${response}= Exchange Migration PKIMessage ${protected_kur} ${CA_BASE_URL} ${SUN_HYBRID_SUFFIX}
PKIMessage Body Type Must Be ${response} kup
PKIStatus Must Be ${response} status=accepted
##############################
# Hybrid-Authentication Tests
##############################
CA Could Support Additional Catalyst Signature
[Documentation] The Catalyst method can be used to alternative sing a PKIMessage. We send
... a certificate request, which is additionally signed by a alternative key.
... The CA should correctly validate the signature and issue the certificate.
[Tags] hybrid-auth
${key1}= Generate Default Key
${alt_key}= Generate Default PQ Sig Key
${ir}= Build Ir From Key ${key1} exclude_fields=senderKID,sender
${protected_ir}= Protect Hybrid PKIMessage
... ${ir}
... protection=catalyst
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
... alt_signing_key=${alt_key}
... include_alt_pub_key=True
... bad_message_check=False
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${MULTI_AUTH_SUFFIX}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} status=rejection
CA Could Detect Bad alternative message check
[Documentation] The Catalyst method can be used to alternative sing a PKIMessage. We send
... a certificate request, which is additionally signed by a alternative key,
... but the alternative signature is invalid. The CA should reject the request
... and MAY respond with the optional failInfo `badMessageCheck`.
[Tags] hybrid-auth
${key1}= Generate Default Key
${alt_key}= Generate Default PQ Sig Key
${ir}= Build Ir From Key ${key1} exclude_fields=senderKID,sender
${protected_ir}= Protect Hybrid PKIMessage
... ${ir}
... protection=catalyst
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
... alt_signing_key=${alt_key}
... include_alt_pub_key=True
... bad_message_check=True
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${MULTI_AUTH_SUFFIX}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} status=rejection
CA MUST Issue a valid Chameleon Cert
[Documentation] According to chameleon-certs-05 section 5, is a valid paired CSR send.
... The CA should issue a valid chameleon certificate.
[Tags] positive
${pq_key}= Generate Default PQ SIG Key
${trad_key}= Generate Key rsa length=2048
${csr}= Build Paired CSR ${trad_key} ${pq_key}
${p10cr}= Build P10cr From CSR ${csr} recipient=${RECIPIENT}
... exclude_fields=sender,senderKID implicit_confirm=True
${protected_p10cr}= Default Protect PKIMessage ${p10cr}
${response}= Exchange Migration PKIMessage ${protected_p10cr} ${CA_BASE_URL} ${CHAMELEON_SUFFIX}
PKIMessage Body Type Must Be ${response} cp
PKIStatus Must Be ${response} status=accepted
${cert}= Get Cert From PKIMessage ${response}
${delta_cert}= Build Delta Cert From Paired Cert ${cert}
VAR ${extracted_delta_cert} ${response["extraCerts"][1]}
${der_delta}= Encode To Der ${delta_cert}
${der_extracted_delta}= Encode To Der ${extracted_delta_cert}
Should Be Equal ${der_delta} ${der_extracted_delta} The delta certificate should
... be the same as the extracted delta certificate.
VAR ${CHAMELEON_CERT} ${cert} scope=Global
VAR ${CHAMELEON_KEY} ${trad_key} scope=Global
VAR ${CHAMELEON_DELTA_CERT} ${delta_cert} scope=Global
VAR ${CHAMELEON_DELTA_KEY} ${pq_key} scope=Global
CA Could Support Composite Signature with Chameleon Cert
[Documentation] A CA could support a PKIMessage signed with composite signature with a chameleon
... certificate. We send a certificate request, which is signed with a composite signature.
... The CA should correctly validate the signature and issue the certificate.
[Tags] hybrid-auth
${result}= Is Certificate And Key Set ${CHAMELEON_CERT} ${CHAMELEON_KEY}
SKIP IF not ${result} The Chameleon Certificate and Key are not set.
${key}= Generate Default Key
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender
${protected_ir}= Protect Hybrid PKIMessage
... ${ir}
... protection=composite
... private_key=${CHAMELEON_KEY}
... cert=${CHAMELEON_CERT}
... alt_signing_key=${CHAMELEON_DELTA_KEY}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${MULTI_AUTH_SUFFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=accepted
CA Could Detect Bad Composite Signature with Chameleon Cert
[Documentation] A CA could support a PKIMessage signed with composite signature with a chameleon
... certificate. We send a certificate request, which is signed with a composite signature,
... but the signature is invalid. The CA should reject the request and MAY respond with the
... optional failInfo `badMessageCheck`.
[Tags] hybrid-auth
${result}= Is Certificate And Key Set ${CHAMELEON_CERT} ${CHAMELEON_KEY}
SKIP IF not ${result} The Chameleon Certificate and Key are not set.
${key}= Generate Default Key
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender
${protected_ir}= Protect Hybrid PKIMessage
... ${ir}
... protection=composite
... private_key=${CHAMELEON_KEY}
... cert=${CHAMELEON_CERT}
... alt_signing_key=${CHAMELEON_DELTA_KEY}
... bad_message_check=True
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${MULTI_AUTH_SUFFIX}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} status=rejection
###########################################
# Cert-bindings-for-multiple-authentication
###########################################
##### positive tests #####
CA MUST Accept valid Request with CSR with related Cert
[Documentation] As defined in Cert-binding-for-multiple-auth Section 3, we generate a CSR with the related
... certificate attribute. We send a valid CSR, with an valid POP, and an valid related certificate
... from the same CA. The CA MUST accept the request and issue a valid certificate.
[Tags] multiple-auth csr positive
Skip if '${URI_RELATED_CERT}' == None The URI for related cert is not defined.
${cert_url}= Prepare Related Cert URL ${PQ_SIG_CERT}
${req_cert}= Prepare RequesterCertificate cert_a=${PQ_SIG_CERT}
... cert_a_key=${PQ_SIG_KEY} uri=${cert_url}
${trad_key}= Generate Default Key
${cm}= Get Next Common Name
${csr}= Build CSR ${trad_key} ${cm} exclude_signature=True
${req_cert}= Add CSR RelatedCertRequest Attribute ${csr} ${req_cert}
${csr}= Sign CSR ${csr} signing_key=${trad_key}
${p10cr}= Build P10cr From CSR ${csr} recipient=${RECIPIENT} exclude_fields=senderKID,sender implicit_confirm=${True}
${protected_p10cr}= Default Protect PKIMessage ${p10cr}
${ca_url}= Get Related Cert URL
${response}= Exchange PKIMessage ${protected_p10cr} ${ca_url}
PKIMessage Body Type Must Be ${response} cp
PKIStatus Must Be ${response} accepted
${cert}= Get Cert From PKIMessage ${response}
Validate Related Cert Extension ${cert} ${PQ_SIG_CERT}
VAR ${RELATED_KEY} ${trad_key} scope=Global
VAR ${RELATED_CERT} ${cert} scope=Global
VAR ${RELATED_KEY_SEC} ${PQ_SIG_KEY} scope=Global
VAR ${RELATED_CERT_SEC} ${PQ_SIG_CERT} scope=Global
CA SHOULD Accept CSR with related cert from different CA
[Documentation] As defined in Cert-binding-for-multiple-auth Section 3, we generate a CSR with the related
... certificate attribute. We send a valid CSR, with an valid POP, but an valid related certificate
... from a different CA. The CA SHOULD accept the request and issue a valid certificate.
[Tags] multiple-auth csr positive different-ca
Skip if '${URI_RELATED_CERT}' == None The URI for related cert is not defined.
# TODO uncomment, if needed.
# get a new cert, if the CA requires to issue a related cert in time.
# ${ir}= Generate Default IR Sig Protected
# ${response}= Exchange PKIMessage ${ir}
# PKIMessage Body Type Must Be ${response} ip
# PKIStatus Must Be ${response} accepted
# ${new_cert}= Get Cert From PKIMessage ${response}
# ${key}= Get From List ${burned_keys} -1
# must then change the variables.
${cert_url}= Prepare Related Cert URL ${ISSUED_CERT}
${req_cert}= Prepare RequesterCertificate cert_a=${ISSUED_CERT}
... cert_a_key=${ISSUED_KEY} uri=${cert_url}
${pq_key}= Generate Default PQ SIG Key
${cm}= Get Next Common Name
${csr}= Build CSR ${pq_key} ${cm} exclude_signature=True
${req_cert}= Add CSR RelatedCertRequest Attribute ${csr} ${req_cert}
${csr}= Sign CSR ${csr} signing_key=${pq_key}
${p10cr}= Build P10cr From CSR ${csr} recipient=${RECIPIENT} exclude_fields=senderKID,sender implicit_confirm=${True}
${protected_p10cr}= Protect PKIMessage
... pki_message=${p10cr}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange PKIMessage ${protected_p10cr}
PKIMessage Body Type Must Be ${response} cp
PKIStatus Must Be ${response} accepted
# TODO decide how to handle the multiple auth in CertTemplate!
# Technically one to one for x509 inside the CertTemplate.
# But not defined, so either added in a experimental file or excluded.
##### negative tests #####
CA MUST Reject Invalid POP for Cert A
[Documentation] As defined in Cert-binding-for-multiple-auth Section 3, we generate a CSR with the related
... certificate attribute. We send a valid CSR, with an invalid POPO for the signature inside the
... `RequesterCertificate` structure. The CA MUST detect this error and reject the request and MAY
... respond with the optional failInfo `badPOP`.
[Tags] multiple-auth csr negative popo
Skip if '${URI_RELATED_CERT}' == None The URI for related cert is not defined.
${cert_url}= Prepare Related Cert URL ${ISSUED_CERT}
${req_cert}= Prepare RequesterCertificate cert_a=${ISSUED_CERT}
... cert_a_key=${ISSUED_KEY} uri=${cert_url} bad_pop=True
${pq_key}= Generate Default PQ SIG Key
${cm}= Get Next Common Name
${csr}= Build CSR ${pq_key} ${cm} exclude_signature=True
${req_cert}= Add CSR RelatedCertRequest Attribute ${csr} ${req_cert}
${csr}= Sign CSR ${csr} signing_key=${pq_key}
${p10cr}= Build P10cr From CSR ${csr} recipient=${RECIPIENT} exclude_fields=senderKID,sender implicit_confirm=${True}
${protected_p10cr}= Default Protect PKIMessage ${p10cr}
${ca_url}= Get Related Cert URL
${response}= Exchange PKIMessage ${protected_p10cr} ${ca_url}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badPOP
# TODO may change the failInfo to a more fitting one.
CA MUST Validate that the URI is reachable
[Documentation] As defined in Cert-binding-for-multiple-auth Section 3, we generate a CSR with the related
... certificate attribute. We send a valid CSR, with an valid POP, but an
... unreachable URI for the related certificate. The CA MUST detect this error and reject
... the request and MAY respond with the optional failInfo `badRequest`.
[Tags] multiple-auth csr negative uri
Skip if '${NEG_URI_RELATED_CERT}' == None The Not reachable URI for multiple auth is not defined.
${req_cert}= Prepare RequesterCertificate cert_a=${ISSUED_CERT}
... cert_a_key=${ISSUED_KEY} uri=${NEG_URI_RELATED_CERT}
${pq_key}= Generate Default PQ SIG Key
${cm}= Get Next Common Name
${csr}= Build CSR ${pq_key} ${cm} exclude_signature=True
${req_cert}= Add CSR RelatedCertRequest Attribute ${csr} ${req_cert}
${csr}= Sign CSR ${csr} signing_key=${pq_key}
${p10cr}= Build P10cr From CSR ${csr} recipient=${RECIPIENT} exclude_fields=senderKID,sender implicit_confirm=${True}
${protected_p10cr}= Default Protect PKIMessage ${p10cr}
${ca_url}= Get Related Cert URL
${response}= Exchange PKIMessage ${protected_p10cr} ${ca_url}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} systemFailure,badPOP
CA MUST Check If The Related Certificate Is Not Revoked.
[Documentation] As defined in Cert-binding-for-multiple-auth Section 3.2, we generate a CSR with the related
... certificate attribute. We send a valid CSR, with an valid POP, but an invalid related certificate
... for the related certificate. The CA MUST detect this error and reject the request and MAY
... respond with the optional failInfo `badCertTemplate`.
[Tags] multiple-auth csr negative rr
Skip if '${URI_RELATED_CERT}' == None The URI for related cert is not defined.
${cert_url}= Prepare Related Cert URL ${REVOKED_CERT}
${req_cert}= Prepare RequesterCertificate cert_a=${REVOKED_CERT}
... cert_a_key=${REVOKED_KEY} uri=${cert_url}
${pq_key}= Generate Default PQ SIG Key
${cm}= Get Next Common Name
${csr}= Build CSR ${pq_key} ${cm} exclude_signature=True
${req_cert}= Add CSR RelatedCertRequest Attribute ${csr} ${req_cert}
${csr}= Sign CSR ${csr} signing_key=${pq_key}
${p10cr}= Build P10cr From CSR ${csr} recipient=${RECIPIENT} exclude_fields=senderKID,sender implicit_confirm=${True}
${protected_p10cr}= Default Protect PKIMessage ${p10cr}
${ca_url}= Get Related Cert URL
${response}= Exchange PKIMessage ${protected_p10cr} ${ca_url}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate,certRevoked
Verify StatusString ${response} any_text=certificate, not valid all_text=revoked
CA MUST Check If The Related Certificate Is Not Updated
[Documentation] As defined in Cert-binding-for-multiple-auth Section 3.2, we generate a CSR with the related
... certificate attribute. We send a valid CSR, with an valid POP, but an invalid related certificate
... for the related certificate. The CA MUST detect this error and reject the request and MAY
... respond with the optional failInfo `badCertTemplate`.
[Tags] multiple-auth csr negative rr
Skip if '${URI_RELATED_CERT}' == None The URI for related cert is not defined.
${cert_url}= Prepare Related Cert URL ${UPDATED_CERT}
${req_cert}= Prepare RequesterCertificate cert_a=${UPDATED_CERT}
... cert_a_key=${UPDATED_KEY} uri=${cert_url}
${pq_key}= Generate Default PQ SIG Key
${cm}= Get Next Common Name
${csr}= Build CSR ${pq_key} ${cm} exclude_signature=True
${req_cert}= Add CSR RelatedCertRequest Attribute ${csr} ${req_cert}
${csr}= Sign CSR ${csr} ${pq_key}
${p10cr}= Build P10cr From CSR ${csr} recipient=${RECIPIENT} exclude_fields=senderKID,sender implicit_confirm=${True}
${protected_p10cr}= Default Protect PKIMessage ${p10cr}
${ca_url}= Get Related Cert URL
${response}= Exchange PKIMessage ${protected_p10cr} ${ca_url}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate,certRevoked
Verify StatusString ${response} any_text=certificate, not valid, update, updated
CA MUST Reject Related Cert With Non-EE Cert
[Documentation] As defined in Cert-binding-for-multiple-auth Section 3.2, we generate a CSR with the related
... certificate attribute. We send a valid CSR, with an valid POP, but the Certificates is not for
... an end entity. The CA MUST detect this error and reject the request and MAY respond with the
... optional failInfo `badCertTemplate`.
[Tags] multiple-auth csr negative
Skip if '${URI_RELATED_CERT}' == None The URI for related cert is not defined.
${cert_url}= Prepare Related Cert URL ${CA_CERT}
${req_cert}= Prepare RequesterCertificate cert_a=${CA_CERT}
... cert_a_key=${CA_KEY} uri=${cert_url}
${pq_key}= Generate Default PQ SIG Key
${cm}= Get Next Common Name
${csr}= Build CSR ${pq_key} ${cm} exclude_signature=True
${req_cert}= Add CSR RelatedCertRequest Attribute ${csr} ${req_cert}
${csr}= Sign CSR ${csr} signing_key=${pq_key}
${p10cr}= Build P10cr From CSR ${csr} recipient=${RECIPIENT} exclude_fields=senderKID,sender implicit_confirm=${True}
${protected_p10cr}= Default Protect PKIMessage ${p10cr}
${ca_url}= Get Related Cert URL
${response}= Exchange PKIMessage ${protected_p10cr} ${ca_url}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate,badRequest
CA MUST Reject Related Cert For Non-EE Cert
[Documentation] As defined in Cert-binding-for-multiple-auth Section 3, we generate a CSR with the related
... certificate attribute. We send a valid CSR, with an valid POP, and an valid related certificate
... from the same CA. The CA MUST accept the request and issue a valid certificate.
[Tags] multiple-auth csr positive
Skip if '${URI_RELATED_CERT}' == None The URI for related cert is not defined.
${cert_url}= Prepare Related Cert URL ${ISSUED_CERT}
${extns}= Prepare Extensions is_ca=True
${req_cert}= Prepare RequesterCertificate cert_a=${ISSUED_CERT}
... cert_a_key=${ISSUED_KEY} uri=${cert_url}
${pq_key}= Generate Default PQ SIG Key
${cm}= Get Next Common Name
${csr}= Build CSR ${pq_key} ${cm} exclude_signature=True extensions=${extns}
${req_cert}= Add CSR RelatedCertRequest Attribute ${csr} ${req_cert}
${csr}= Sign CSR ${csr} signing_key=${pq_key}
${p10cr}= Build P10cr From CSR ${csr} recipient=${RECIPIENT} exclude_fields=senderKID,sender implicit_confirm=${True}
${protected_p10cr}= Default Protect PKIMessage ${p10cr}
${ca_url}= Get Related Cert URL
${response}= Exchange PKIMessage ${protected_p10cr} ${ca_url}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate,badRequest
CA Could Support Composite Signature with Related Cert
[Documentation] A CA could support a PKIMessage signed with composite signature with a related
... certificate. We send a certificate request, which is signed with a composite signature.
... The CA should correctly validate the signature and issue the certificate.
[Tags] hybrid-auth composite-sig
${result}= Is Certificate And Key Set ${RELATED_CERT} ${RELATED_KEY}
SKIP IF not ${result} The Related Certificate and Key are not set.
${key}= Generate Default Key
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender
${protected_ir}= Protect Hybrid PKIMessage
... ${ir}
... protection=composite
... private_key=${RELATED_KEY}
... cert=${RELATED_CERT}
... alt_signing_key=${RELATED_KEY_SEC}
${protected_ir}= Add Certs To PKIMessage ${protected_ir} ${RELATED_CERT_SEC}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${MULTI_AUTH_SUFFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=accepted
CA Could Detect Bad Composite Signature with Related Cert
[Documentation] A CA could support a PKIMessage signed with composite signature with a related
... certificate. We send a certificate request, which is signed with a composite signature,
... but the signature is invalid. The CA should reject the request and MAY respond with the
... optional failInfo `badMessageCheck`.
[Tags] hybrid-auth composite-sig
${result}= Is Certificate And Key Set ${RELATED_CERT} ${RELATED_KEY}
SKIP IF not ${result} The Related Certificate and Key are not set.
${key}= Generate Default Key
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender
${protected_ir}= Protect Hybrid PKIMessage
... ${ir}
... protection=composite
... private_key=${RELATED_KEY}
... cert=${RELATED_CERT}
... alt_signing_key=${RELATED_KEY_SEC}
... bad_message_check=True
${protected_ir}= Add Certs To PKIMessage ${protected_ir} ${RELATED_CERT_SEC}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${MULTI_AUTH_SUFFIX}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} status=rejection
##########################
# BadCertTemplate Tests
##########################
CA Should not allow Key Update with same key
[Documentation] The CA should not allow a key update with the same key.
... We send a certificate request, which contains the same key as the previous certificate.
... The CA should reject the request and MAY respond with the optional failInfo `badCertTemplate`.
[Tags] bad-cert-template composite-sig
${result}= Is Certificate And Key Set ${COMPOSITE_SIG_CERT} ${COMPOSITE_SIG_KEY}
SKIP IF not ${result} The Composite Certificate and Key are not set.
${ir}= Build Key Update Request ${COMPOSITE_SIG_KEY} ${COMPOSITE_SIG_CERT}
${protected_ir}= Protect Hybrid PKIMessage
... ${ir}
... protection=composite
... private_key=${COMPOSITE_SIG_KEY}
... cert=${COMPOSITE_SIG_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${COMPOSITE_URL_PREFIX}
PKIMessage Body Type Must Be ${response} kup
PKIStatus Must Be ${response} status=rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate
CA Should not allow Key Update with revoked key
[Documentation] The CA should not allow a key update with a revoked composite-sig key.
... We send a certificate request, which contains a revoked composite-sig key.
... The CA should reject the request and MAY respond with the optional failInfo
... `badCertTemplate`.
[Tags] badCertTemplate composite-sig
${result}= Is Certificate And Key Set ${REVOKED_COMP_CERT} ${REVOKED_COMP_KEY}
SKIP IF not ${result} The Revoked Composite Certificate and Key are not set.
${ir}= Build Key Update Request ${REVOKED_COMP_KEY} ${REVOKED_COMP_CERT}
${protected_ir}= Protect Hybrid PKIMessage
... ${ir}
... protection=composite
... private_key=${REVOKED_COMP_KEY}
... cert=${REVOKED_COMP_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${COMPOSITE_URL_PREFIX}
PKIMessage Body Type Must Be ${response} error
PKIStatus Must Be ${response} status=rejection
PKIStatusInfo Failinfo Bit Must Be ${response} certRevoked
CA MUST Reject A Revoked Composite Sig Key
[Documentation] According to composite-sig-cms07 the keys should not be used inside another certificate.
... We send a composite-sig certificate request, which contains a already revoked key.
... The CA MUST reject the request and MAY respond with the optional failInfo `badCertTemplate`.
[Tags] composite-sig badCertTemplate
${result}= Is Certificate And Key Set ${REVOKED_COMP_CERT} ${REVOKED_COMP_KEY}
SKIP IF not ${result} The Revoked Composite Certificate and Key are not set.
${key}= Generate Default Key
${ir}= Build Ir From Key ${REVOKED_COMP_KEY} exclude_fields=senderKID,sender
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${COMPOSITE_URL_PREFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate
CA MUST Accept A Valid Composite Sig Update Request
[Documentation] The CA should accept a valid composite-sig key update request.
... We send a composite-sig certificate request, which contains a new key,
... the CA should accept the request and issue a valid certificate.
[Tags] composite-sig
${key}= Generate Unique Key composite-sig
${url}= Add URL Suffix ${CA_BASE_URL} ${COMPOSITE_URL_PREFIX}
${cert} ${_}= Issue New Cert For Testing ${url} ${key}
${key_up}= Generate Unique Key composite-sig
${cm}= Get Next Common Name
${kur}= Build Key Update Request ${key_up} ${cert} exclude_fields=senderKID,sender
... common_name=${cm}
${protected_kur}= Protect PKIMessage ${kur} signature private_key=${key} cert=${cert}
${response}= Exchange PKIMessage ${protected_kur} ${url}
PKIMessage Body Type Must Be ${response} kup
PKIStatus Must Be ${response} accepted
${_}= Confirm Certificate If Needed ${response} url=${url} protection=signature
... private_key=${key} cert=${cert}
Wait Until Server Updated Cert
VAR ${UPDATED_COMP_SIG_CERT} ${cert} scope=Global
VAR ${UPDATED_COMP_SIG_KEY} ${key} scope=Global
CA MUST Reject A Update Composite Sig Key
[Documentation] According to composite-sig-cms07 the keys should not be used inside another certificate.
... We send a composite-sig certificate request, which contains a already updated key.
... The CA MUST reject the request and MAY respond with the optional failInfo `badCertTemplate`.
[Tags] composite-sig
${result}= Is Certificate And Key Set ${UPDATED_COMP_SIG_CERT} ${UPDATED_COMP_SIG_KEY}
SKIP IF not ${result} The Updated Composite Certificate and Key are not set.
${key}= Generate Default Key
${cert_template}= Prepare CertTemplate ${UPDATED_COMP_SIG_KEY} cert=${UPDATED_COMP_SIG_CERT} include_fields=subject,publicKey
${ir}= Build Ir From Key ${UPDATED_COMP_SIG_KEY} cert_template=${cert_template} exclude_fields=senderKID,sender
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${COMPOSITE_URL_PREFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate
CA MUST Reject A Revoked Composite KEM Key
[Documentation] According to composite-kem-pki07 the keys should not be used inside another certificate.
... We send a composite-sig certificate request, which contains a already revoked key.
... The CA MUST reject the request and MAY respond with the optional failInfo `badCertTemplate`.
[Tags] composite-kem
${result}= Is Certificate And Key Set ${REVOKED_COMP_KEM_CERT} ${REVOKED_COMP_KEM_KEY}
SKIP IF not ${result} The Revoked Composite KEM Certificate and Key are not set.
${key}= Generate Default Key
${ir}= Build Ir From Key ${REVOKED_COMP_KEM_KEY} exclude_fields=senderKID,sender
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${COMPOSITE_URL_PREFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate
CA MUST Reject A Update Composite KEM Key
[Documentation] According to composite-kem-pki07 the keys should not be used inside another certificate.
... We send a composite-sig certificate request, which contains a already updated key.
... The CA MUST reject the request and MAY respond with the optional failInfo `badCertTemplate`.
[Tags] composite-kem
${result}= Is Certificate And Key Set ${COMPOSITE_KEM_CERT} ${COMPOSITE_KEM_KEY}
SKIP IF not ${result} The Updated Composite KEM Certificate and Key are not set.
${key}= Generate Default Key
${ir}= Build Ir From Key ${COMPOSITE_KEM_KEY} exclude_fields=senderKID,sender
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${COMPOSITE_URL_PREFIX}
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate
CA MUST Check That The ML-DSA Key Is Not Used Inside Another Cert
[Documentation] According to composite-sig-cms07 the keys should not be used inside another certificate.
... We send a composite-sig certificate request, which contains a ML-DSA key, which is already used
... inside another certificate. The CA MUST reject the request and MAY respond with the optional
... failInfo `badCertTemplate`.
[Tags] composite-sig composite
${result}= Is Certificate And Key Set ${COMPOSITE_SIG_CERT} ${COMPOSITE_SIG_KEY}
SKIP IF not ${result} The Composite Certificate and Key are not set.
${key}= Generate Key algorithm=composite-sig pq_key=${COMPOSITE_SIG_KEY.pq_key}
${cert_template}= Prepare CertTemplate ${key} cert=${COMPOSITE_SIG_CERT} include_fields=subject,publicKey
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender cert_template=${cert_template}
${protected_ir}= Default Protect PKIMessage ${ir}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${COMPOSITE_URL_PREFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate
CA MUST Check that the traditional key is not used inside another Cert
[Documentation] According to composite-sig-cms07 the keys should not be used inside another certificate.
... We send a composite-sig certificate request, which contains a traditional key, which is
... already used inside another certificate. The CA MUST reject the request and MAY respond with
... the optional failInfo `badCertTemplate`.
[Tags] composite-sig composite
${result}= Is Certificate And Key Set ${COMPOSITE_SIG_CERT} ${COMPOSITE_SIG_KEY}
SKIP IF not ${result} The Composite Certificate and Key are not set, the setup failed.
${key}= Generate Key algorithm=composite-sig trad_key=${COMPOSITE_SIG_KEY.trad_key}
${cert_template}= Prepare CertTemplate ${key} cert=${COMPOSITE_SIG_CERT} include_fields=subject,publicKey
${ir}= Build Ir From Key ${key} exclude_fields=senderKID,sender cert_template=${cert_template}
${protected_ir}= Protect PKIMessage
... ${ir}
... protection=signature
... private_key=${ISSUED_KEY}
... cert=${ISSUED_CERT}
${response}= Exchange Migration PKIMessage ${protected_ir} ${CA_BASE_URL} ${COMPOSITE_URL_PREFIX}
PKIMessage Body Type Must Be ${response} ip
PKIStatus Must Be ${response} status=rejection
PKIStatusInfo Failinfo Bit Must Be ${response} badCertTemplate
CA MUST Check that the ML-KEM key is not used inside another Cert
[Documentation] According to composite-kem-pki07 the keys should not be used inside another certificate.
... We send a composite-sig certificate request, which contains a ML-KEM key, which is already used
... inside another certificate. The CA MUST reject the request and MAY respond with the optional