DEFINITION MODULE TLSRSA;

        (********************************************************)
        (*                                                      *)
        (*                 TLS-RSA private key                  *)
        (*                                                      *)
        (*  Programmer:         P. Moylan                       *)
        (*  Started:            14 October 2024                 *)
        (*  Last edited:        14 November 2024                *)
        (*  Status:             Being tested                    *)
        (*                                                      *)
        (********************************************************)


IMPORT RSAKeys, SYSTEM, VarStrings;

PROCEDURE LoadRSAPrivateKey (filename: ARRAY OF CHAR): RSAKeys.RSAKeyType;

    (* Gets RSA private key from a file.  *)

PROCEDURE PKCS1Encrypt (key: RSAKeys.RSAKeyType;  L: CARDINAL;
                            VAR (*IN*) message: ARRAY OF SYSTEM.LOC): VarStrings.ByteStr;

    (* Returns an encrypted copy of the message, of length L, using     *)
    (* the algorithm RSAES-PKCS1-V1_5-ENCRYPT in RFC 8017 (page 29).    *)
    (* The result is longer than L because padding is added.            *)

END TLSRSA.

