: Fair exchange protocols allow both or neither of two parties to obtain the other's items, and this property is essential in e-commerce. In this paper, we construct an optimistic fair exchange protocol that is applicable to any digital signature by prescribing three forms of signatures, namely presignature, post-signature and notarised signature. We set an expiration date for presignature, and thus realise the timely termination of the protocol. Next, we define an ideal functionality of fair exchangeprotocolsintheuniversalcomposabilityframework. Then, weconstructanoptimisticfair exchangeprotocolbasedontheaboveprotocol, andproveitssecurityintheuniversalcomposability framework.