raw
smg_comms_io_rsa_...    1  -- reading a RSA key pair from a file
smg_comms_io_rsa_... 2 -- NB: this is for TESTING purposes only, NOT a production IO package!
smg_comms_io_rsa_... 3 -- S.MG, 2018
smg_comms_io_rsa_... 4
smg_comms_io_rsa_... 5 with Raw_Types;
smg_comms_io_rsa_... 6 with RSA_OAEP;
smg_comms_io_rsa_... 7
smg_comms_io_rsa_... 8 package IO_RSA is
smg_comms_io_rsa_... 9
smg_comms_io_rsa_... 10 -- reads a full private key from specified file, in Hex format
smg_comms_io_rsa_... 11 -- one component per line, in order: n, e, d, p, q, u
smg_comms_io_rsa_... 12 -- NB: length of each component has to match *precisely* the expected length
smg_comms_io_rsa_... 13 -- specifically, using Raw_Types:
smg_comms_io_rsa_... 14 -- n, d are RSA_len'Length*2;
smg_comms_io_rsa_... 15 -- e, p, q, u are RSA_half'Length*2
smg_comms_io_rsa_... 16 procedure ReadRSAKey( Filename: in String; Key: out RSA_OAEP.RSA_skey );
smg_comms_io_rsa_... 17
smg_comms_io_rsa_... 18 -- convert hexadecimal strings to octets representation
smg_comms_io_rsa_... 19 procedure Hex2Octets( Hex: in String; O: out Raw_Types.Octets );
smg_comms_io_rsa_... 20
smg_comms_io_rsa_... 21 end IO_RSA;