@@ -567,21 +567,19 @@ mod tests {
567567 use cryptography:: ext:: CertReqInfoExt ;
568568 use cryptography:: x509:: attr:: Attribute ;
569569 use cryptography:: x509:: request:: { CertReq , CertReqInfo , ExtensionReq } ;
570- #[ cfg( feature = "insecure" ) ]
571570 use cryptography:: x509:: PkiPath ;
572571 use cryptography:: x509:: { ext:: Extension , name:: RdnSequence } ;
573572 use der:: { AnyRef , Encode } ;
574- use kvm:: Kvm ;
575573 #[ cfg( feature = "insecure" ) ]
576574 use sgx_validation:: Sgx ;
577575 #[ cfg( feature = "insecure" ) ]
578576 use snp_validation:: { Evidence , Snp } ;
579577
580- #[ cfg( feature = "insecure" ) ]
581578 use axum:: response:: Response ;
582579 use http:: header:: CONTENT_TYPE ;
583580 use http:: Request ;
584581 use hyper:: Body ;
582+ #[ cfg( feature = "insecure" ) ]
585583 use rstest:: rstest;
586584 use tower:: ServiceExt ; // for `app.oneshot()`
587585
@@ -647,7 +645,6 @@ mod tests {
647645 }
648646 }
649647
650- #[ cfg( feature = "insecure" ) ]
651648 async fn attest_response ( state : State , response : Response , multi : bool ) {
652649 let body = hyper:: body:: to_bytes ( response. into_body ( ) ) . await . unwrap ( ) ;
653650
@@ -778,6 +775,22 @@ mod tests {
778775 assert_eq ! ( output. issued. len( ) , five_crs. len( ) ) ;
779776 }
780777
778+ #[ tokio:: test]
779+ async fn sgx_canned_csr ( ) {
780+ let csr = include_bytes ! ( "../crates/sgx_validation/src/icelake.csr" ) ;
781+
782+ let request = Request :: builder ( )
783+ . method ( "POST" )
784+ . uri ( "/" )
785+ . header ( CONTENT_TYPE , PKCS10 )
786+ . body ( Body :: from ( Bytes :: from ( csr. as_slice ( ) ) ) )
787+ . unwrap ( ) ;
788+
789+ let response = app ( certificates_state ( ) ) . oneshot ( request) . await . unwrap ( ) ;
790+ assert_eq ! ( response. status( ) , StatusCode :: OK ) ;
791+ attest_response ( certificates_state ( ) , response, false ) . await ;
792+ }
793+
781794 #[ cfg( feature = "insecure" ) ]
782795 #[ rstest]
783796 #[ case( PKCS10 , false ) ]
@@ -839,6 +852,22 @@ mod tests {
839852 }
840853 }
841854
855+ #[ tokio:: test]
856+ async fn snp_canned_csr ( ) {
857+ let csr = include_bytes ! ( "../crates/snp_validation/src/milan.csr" ) ;
858+
859+ let request = Request :: builder ( )
860+ . method ( "POST" )
861+ . uri ( "/" )
862+ . header ( CONTENT_TYPE , PKCS10 )
863+ . body ( Body :: from ( Bytes :: from ( csr. as_slice ( ) ) ) )
864+ . unwrap ( ) ;
865+
866+ let response = app ( certificates_state ( ) ) . oneshot ( request) . await . unwrap ( ) ;
867+ assert_eq ! ( response. status( ) , StatusCode :: OK ) ;
868+ attest_response ( certificates_state ( ) , response, false ) . await ;
869+ }
870+
842871 #[ cfg( feature = "insecure" ) ]
843872 #[ rstest]
844873 #[ case( PKCS10 , false ) ]
0 commit comments