1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. with Ada.Streams;                       use Ada.Streams; 
  10. with GNAT.Strings;                      use GNAT.Strings; 
  11.  
  12. package Content_Signing is 
  13.  
  14.     -- Enable/disable validation of files that don't have known signatures. 
  15.     procedure Allow_Unsigned_Content( enabled : Boolean ); 
  16.  
  17.     -- Returns True if a signature for 'filename' is known. 
  18.     function Is_Signed( filename : String ) return Boolean; 
  19.  
  20.     -- Returns True if 'filename' has a known signature and it matches the 
  21.     -- signature of 'data'. 
  22.     function Is_Valid( filename : String; 
  23.                        data     : Stream_Element_Array ) return Boolean; 
  24.  
  25.     -- Calculates the signatures of all files in the 'inFiles' list and writes 
  26.     -- a signed dictionary to 'filename'. If the dictionary file already 
  27.     -- exists, it will be overwritten. An exception will be raised on error and 
  28.     -- the partial dictionary file will be cleaned up. 
  29.     procedure Make_Dictionary( filename  : String; 
  30.                                inFiles   : String_List; 
  31.                                authority : String; 
  32.                                progress  : access procedure( filename   : String; 
  33.                                                              completion : Natural ) := null ); 
  34.  
  35.     -- raised by Make_Dictionary when a file operation fails 
  36.     File_Error : exception; 
  37.  
  38. end Content_Signing;