@@ -87,9 +87,9 @@ func testGetManifestIncludesInitialPolicy(t *testing.T) {
8787 m , err := writer .GetManifest (t .Context ())
8888 require .NoError (t , err )
8989 require .NotNil (t , m )
90- require .NotEmpty (t , m .EncryptionInformation . Policy , "expected provisional policy in stub manifest" )
90+ require .NotEmpty (t , m .Policy , "expected provisional policy in stub manifest" )
9191
92- policyBytes , err := ocrypto .Base64Decode ([]byte (m .EncryptionInformation . Policy ))
92+ policyBytes , err := ocrypto .Base64Decode ([]byte (m .Policy ))
9393 require .NoError (t , err )
9494
9595 var pol Policy
@@ -105,8 +105,8 @@ func testGetManifestIncludesInitialPolicy(t *testing.T) {
105105 assert .True (t , found , "provisional policy should include initial attribute FQN" )
106106
107107 // Pre-finalize manifest should include kaos based on initial attributes, and estimated root signature
108- assert .Len (t , m .EncryptionInformation . KeyAccessObjs , 1 )
109- assert .NotEmpty (t , m .EncryptionInformation . RootSignature . Signature )
108+ assert .Len (t , m .KeyAccessObjs , 1 )
109+ assert .NotEmpty (t , m .Signature )
110110}
111111
112112// Sparse indices end-to-end: write 0,1,2,5000,5001,5002 and verify manifest and totals.
@@ -138,7 +138,7 @@ func testSparseIndicesInOrder(t *testing.T) {
138138 require .NotNil (t , fin .Manifest )
139139 assert .Equal (t , len (order ), fin .TotalSegments )
140140
141- segs := fin .Manifest .EncryptionInformation . IntegrityInformation . Segments
141+ segs := fin .Manifest .Segments
142142 require .Len (t , segs , len (order ))
143143 // Ensure manifest segments are densely packed and sizes match our inputs in order
144144 expectedPlain := 0
@@ -178,7 +178,7 @@ func testSparseIndicesOutOfOrder(t *testing.T) {
178178 require .NotNil (t , fin .Manifest )
179179 assert .Equal (t , len (finalOrder ), fin .TotalSegments )
180180
181- segs := fin .Manifest .EncryptionInformation . IntegrityInformation . Segments
181+ segs := fin .Manifest .Segments
182182 require .Len (t , segs , len (finalOrder ))
183183 expectedPlain := 0
184184 for i , idx := range finalOrder {
@@ -211,9 +211,9 @@ func testInitialAttributesOnWriter(t *testing.T) {
211211 fin1 , err := writer .Finalize (ctx )
212212 require .NoError (t , err )
213213 require .NotNil (t , fin1 .Manifest )
214- assert .GreaterOrEqual (t , len (fin1 .Manifest .EncryptionInformation . KeyAccessObjs ), 1 )
214+ assert .GreaterOrEqual (t , len (fin1 .Manifest .KeyAccessObjs ), 1 )
215215
216- policyBytes , err := ocrypto .Base64Decode ([]byte (fin1 .Manifest .EncryptionInformation . Policy ))
216+ policyBytes , err := ocrypto .Base64Decode ([]byte (fin1 .Manifest .Policy ))
217217 require .NoError (t , err )
218218 var pol1 Policy
219219 require .NoError (t , json .Unmarshal (policyBytes , & pol1 ))
@@ -241,7 +241,7 @@ func testInitialAttributesOnWriter(t *testing.T) {
241241 fin2 , err := writer2 .Finalize (ctx , WithAttributeValues (overrideAttrs ))
242242 require .NoError (t , err )
243243
244- policyBytes2 , err := ocrypto .Base64Decode ([]byte (fin2 .Manifest .EncryptionInformation . Policy ))
244+ policyBytes2 , err := ocrypto .Base64Decode ([]byte (fin2 .Manifest .Policy ))
245245 require .NoError (t , err )
246246 var pol2 Policy
247247 require .NoError (t , json .Unmarshal (policyBytes2 , & pol2 ))
@@ -298,22 +298,22 @@ func testBasicTDFCreationFlow(t *testing.T) {
298298
299299 // Verify manifest structure
300300 assert .Equal (t , TDFSpecVersion , finalizeResult .Manifest .TDFVersion , "TDF version should match expected" )
301- assert .Equal (t , "application/octet-stream" , finalizeResult .Manifest .Payload . MimeType , "Default MIME type should be set" )
302- assert .True (t , finalizeResult .Manifest .Payload . IsEncrypted , "Payload should be marked as encrypted" )
303- assert .Equal (t , "zip" , finalizeResult .Manifest .Payload . Protocol , "Protocol should be zip" )
304- assert .Equal (t , "reference" , finalizeResult .Manifest .Payload . Type , "Type should be reference" )
301+ assert .Equal (t , "application/octet-stream" , finalizeResult .Manifest .MimeType , "Default MIME type should be set" )
302+ assert .True (t , finalizeResult .Manifest .IsEncrypted , "Payload should be marked as encrypted" )
303+ assert .Equal (t , "zip" , finalizeResult .Manifest .Protocol , "Protocol should be zip" )
304+ assert .Equal (t , "reference" , finalizeResult .Manifest .Type , "Type should be reference" )
305305
306306 // Verify key access objects
307- assert .Len (t , finalizeResult .Manifest .EncryptionInformation . KeyAccessObjs , 1 , "Should have one key access object for default KAS" )
308- keyAccess := finalizeResult .Manifest .EncryptionInformation . KeyAccessObjs [0 ]
307+ assert .Len (t , finalizeResult .Manifest .KeyAccessObjs , 1 , "Should have one key access object for default KAS" )
308+ keyAccess := finalizeResult .Manifest .KeyAccessObjs [0 ]
309309 assert .Equal (t , testKAS1 , keyAccess .KasURL , "KAS URL should match" )
310310 assert .Equal (t , "kas" , keyAccess .Protocol , "Protocol should be kas" )
311311 assert .NotEmpty (t , keyAccess .WrappedKey , "Wrapped key should not be empty" )
312312
313313 // Verify encryption information
314- assert .Equal (t , kGCMCipherAlgorithm , finalizeResult .Manifest .EncryptionInformation . Method .Algorithm , "Algorithm should be AES-256-GCM" )
315- assert .True (t , finalizeResult .Manifest .EncryptionInformation . Method .IsStreamable , "Should be marked as streamable" )
316- assert .NotEmpty (t , finalizeResult .Manifest .EncryptionInformation . Policy , "Policy should not be empty" )
314+ assert .Equal (t , kGCMCipherAlgorithm , finalizeResult .Manifest .Method .Algorithm , "Algorithm should be AES-256-GCM" )
315+ assert .True (t , finalizeResult .Manifest .Method .IsStreamable , "Should be marked as streamable" )
316+ assert .NotEmpty (t , finalizeResult .Manifest .Policy , "Policy should not be empty" )
317317}
318318
319319// testSingleSegmentWithAttributes tests TDF creation with attribute-based key splitting
@@ -343,10 +343,10 @@ func testSingleSegmentWithAttributes(t *testing.T) {
343343 validateManifestSchema (t , finalizeResult .Manifest )
344344
345345 // Verify key access objects were created for each attribute's KAS
346- assert .GreaterOrEqual (t , len (finalizeResult .Manifest .EncryptionInformation . KeyAccessObjs ), 1 , "Should have at least one key access object" )
346+ assert .GreaterOrEqual (t , len (finalizeResult .Manifest .KeyAccessObjs ), 1 , "Should have at least one key access object" )
347347
348348 // Verify policy contains attributes
349- policyBytes , err := ocrypto .Base64Decode ([]byte (finalizeResult .Manifest .EncryptionInformation . Policy ))
349+ policyBytes , err := ocrypto .Base64Decode ([]byte (finalizeResult .Manifest .Policy ))
350350 require .NoError (t , err )
351351 assert .NotEmpty (t , policyBytes , "Policy should not be empty" )
352352
@@ -406,8 +406,8 @@ func testMultiSegmentFlow(t *testing.T) {
406406 validateManifestSchema (t , finalizeResult .Manifest )
407407
408408 // Verify root signature was calculated from all segments
409- assert .NotEmpty (t , finalizeResult .Manifest .EncryptionInformation . RootSignature . Signature , "Root signature should be set" )
410- assert .Equal (t , "HS256" , finalizeResult .Manifest .EncryptionInformation . RootSignature . Algorithm , "Root signature algorithm should be HS256" )
409+ assert .NotEmpty (t , finalizeResult .Manifest .Signature , "Root signature should be set" )
410+ assert .Equal (t , "HS256" , finalizeResult .Manifest .Algorithm , "Root signature algorithm should be HS256" )
411411}
412412
413413// testKeySplittingWithMultipleAttributes tests XOR key splitting with complex attribute scenarios
@@ -440,7 +440,7 @@ func testKeySplittingWithMultipleAttributes(t *testing.T) {
440440 validateManifestSchema (t , finalizeResult .Manifest )
441441
442442 // Verify multiple key access objects were created
443- keyAccessObjs := finalizeResult .Manifest .EncryptionInformation . KeyAccessObjs
443+ keyAccessObjs := finalizeResult .Manifest .KeyAccessObjs
444444 assert .GreaterOrEqual (t , len (keyAccessObjs ), 1 , "Should have at least one key access object" )
445445
446446 // Verify each key access object has proper structure
@@ -498,10 +498,10 @@ func testManifestGeneration(t *testing.T) {
498498 assert .Equal (t , TDFSpecVersion , finalizeResult .Manifest .TDFVersion , "TDF version should match" )
499499
500500 // Verify payload information
501- assert .Equal (t , customMimeType , finalizeResult .Manifest .Payload . MimeType , "MIME type should match custom value" )
502- assert .Equal (t , "zip" , finalizeResult .Manifest .Payload . Protocol , "Protocol should be zip" )
503- assert .Equal (t , "reference" , finalizeResult .Manifest .Payload . Type , "Type should be reference" )
504- assert .True (t , finalizeResult .Manifest .Payload . IsEncrypted , "Payload should be encrypted" )
501+ assert .Equal (t , customMimeType , finalizeResult .Manifest .MimeType , "MIME type should match custom value" )
502+ assert .Equal (t , "zip" , finalizeResult .Manifest .Protocol , "Protocol should be zip" )
503+ assert .Equal (t , "reference" , finalizeResult .Manifest .Type , "Type should be reference" )
504+ assert .True (t , finalizeResult .Manifest .IsEncrypted , "Payload should be encrypted" )
505505
506506 // Verify encryption information
507507 encInfo := finalizeResult .Manifest .EncryptionInformation
@@ -511,8 +511,8 @@ func testManifestGeneration(t *testing.T) {
511511
512512 // Verify integrity information
513513 intInfo := encInfo .IntegrityInformation
514- assert .Equal (t , "HS256" , intInfo .RootSignature . Algorithm , "Root signature algorithm should be HS256" )
515- assert .NotEmpty (t , intInfo .RootSignature . Signature , "Root signature should not be empty" )
514+ assert .Equal (t , "HS256" , intInfo .Algorithm , "Root signature algorithm should be HS256" )
515+ assert .NotEmpty (t , intInfo .Signature , "Root signature should not be empty" )
516516
517517 // Verify key access objects
518518 assert .GreaterOrEqual (t , len (encInfo .KeyAccessObjs ), 1 , "Should have at least one key access object" )
@@ -598,7 +598,7 @@ func testAssertionsAndMetadata(t *testing.T) {
598598 assert .NotEmpty (t , metadata ["timestamp" ], "Timestamp should be set" )
599599
600600 // Verify encrypted metadata in key access object
601- keyAccess := finalizeResult .Manifest .EncryptionInformation . KeyAccessObjs [0 ]
601+ keyAccess := finalizeResult .Manifest .KeyAccessObjs [0 ]
602602 assert .NotEmpty (t , keyAccess .EncryptedMetadata , "Encrypted metadata should be present" )
603603}
604604
@@ -711,10 +711,10 @@ func testXORReconstruction(t *testing.T) {
711711
712712 // The actual verification of XOR reconstruction is done internally by the splitter,
713713 // but we can verify the structure is correct and key access objects were generated
714- assert .GreaterOrEqual (t , len (finalizeResult .Manifest .EncryptionInformation . KeyAccessObjs ), 1 , "Should have key access objects" )
714+ assert .GreaterOrEqual (t , len (finalizeResult .Manifest .KeyAccessObjs ), 1 , "Should have key access objects" )
715715
716716 // Verify that each key access object has the required fields
717- for i , keyAccess := range finalizeResult .Manifest .EncryptionInformation . KeyAccessObjs {
717+ for i , keyAccess := range finalizeResult .Manifest .KeyAccessObjs {
718718 assert .NotEmpty (t , keyAccess .WrappedKey , "Key access %d should have wrapped key" , i )
719719 assert .NotEmpty (t , keyAccess .KasURL , "Key access %d should have KAS URL" , i )
720720 assert .NotEmpty (t , keyAccess .SplitID , "Key access %d should have split ID" , i )
@@ -764,7 +764,7 @@ func testDifferentAttributeRules(t *testing.T) {
764764
765765 // Verify manifest was created successfully
766766 assert .NotNil (t , finalizeResult .Manifest , "Manifest should not be nil for %s" , tc .name )
767- assert .NotEmpty (t , finalizeResult .Manifest .EncryptionInformation . KeyAccessObjs , "Should have key access objects for %s" , tc .name )
767+ assert .NotEmpty (t , finalizeResult .Manifest .KeyAccessObjs , "Should have key access objects for %s" , tc .name )
768768 })
769769 }
770770}
@@ -1010,11 +1010,11 @@ func testGetManifestBeforeAndAfterFinalize(t *testing.T) {
10101010 require .NoError (t , err )
10111011 require .NotNil (t , m0 )
10121012 assert .Equal (t , TDFSpecVersion , m0 .TDFVersion )
1013- assert .Equal (t , tdfAsZip , m0 .Payload . Protocol )
1014- assert .Equal (t , tdfZipReference , m0 .Payload . Type )
1015- assert .True (t , m0 .Payload . IsEncrypted )
1013+ assert .Equal (t , tdfAsZip , m0 .Protocol )
1014+ assert .Equal (t , tdfZipReference , m0 .Type )
1015+ assert .True (t , m0 .IsEncrypted )
10161016 // No segments yet
1017- assert .Empty (t , m0 .EncryptionInformation . Segments )
1017+ assert .Empty (t , m0 .Segments )
10181018
10191019 // Write a segment and check stub updates
10201020 data := []byte ("abc123" )
@@ -1025,10 +1025,10 @@ func testGetManifestBeforeAndAfterFinalize(t *testing.T) {
10251025 require .NoError (t , err )
10261026 require .NotNil (t , m1 )
10271027 // Should reflect first segment defaults and sizes
1028- assert .Len (t , m1 .EncryptionInformation . Segments , 1 )
1029- assert .Equal (t , int64 (len (data )), m1 .EncryptionInformation . DefaultSegmentSize )
1030- assert .Greater (t , m1 .EncryptionInformation . DefaultEncryptedSegSize , int64 (len (data )))
1031- assert .Equal (t , writer .segmentIntegrityAlgorithm .String (), m1 .EncryptionInformation . SegmentHashAlgorithm )
1028+ assert .Len (t , m1 .Segments , 1 )
1029+ assert .Equal (t , int64 (len (data )), m1 .DefaultSegmentSize )
1030+ assert .Greater (t , m1 .DefaultEncryptedSegSize , int64 (len (data )))
1031+ assert .Equal (t , writer .segmentIntegrityAlgorithm .String (), m1 .SegmentHashAlgorithm )
10321032
10331033 // Finalize and GetManifest should return the final one (with key access, root signature)
10341034 attrs := []* policy.Value {createTestAttribute ("https://example.com/attr/Test/value/Basic" , testKAS1 , "kid1" )}
@@ -1039,8 +1039,8 @@ func testGetManifestBeforeAndAfterFinalize(t *testing.T) {
10391039 m2 , err := writer .GetManifest (t .Context ())
10401040 require .NoError (t , err )
10411041 // Expect at least one key access and a root signature after finalize
1042- assert .Len (t , m2 .EncryptionInformation . KeyAccessObjs , 1 )
1043- assert .NotEmpty (t , m2 .EncryptionInformation . RootSignature . Signature )
1042+ assert .Len (t , m2 .KeyAccessObjs , 1 )
1043+ assert .NotEmpty (t , m2 .Signature )
10441044
10451045 // Ensure GetManifest returns a clone, not the same pointer
10461046 assert .NotSame (t , fin .Manifest , m2 )
0 commit comments