<PAGE>

                                                                     Exhibit 4.2

                            Stock Purchase Agreement

This Stock Purchase Agreement (the "Agreement") has been made and entered into
as of this   12th      day of      January          2002 by and between (i)
           --    -----        -----       ----------
Baltimore Technologies plc (the "Seller") having its registered office at 1310
Waterside, Arlington Business Park, Theale, Berkshire RG7 4SA, England, (ii) CGI
Co. Ltd Kurihara Building 3F 6-10, 3chome Nihonbashi Chuo-Ku 103-0027 Tokyo.
(the "Purchaser") and (iii) Baltimore Technologies Japan Co., Ltd. (the "BTJ")
having its registered address at New Otani Garden Court 8F, 4-1, Kioi-Cho,
Chiyoda-ku, Tokyo in connection with the purchase and sale of the shares common
stock of BTJ (the "Shares").

1.   Purchase and Sale of Shares

1.1  The Seller agrees to sell and the Purchaser agrees to purchase from the
     Seller the 11,000 Shares at the purchase price of 81,819 yen per Share and
     in aggregate 900,009,000 yen (the "Purchase Price") on the terms and
     subject to the conditions as provided herein.

1.2  The Purchaser shall make the following non refundable payments for the
     number of shares set out opposite the payment.

             Date            Amount     Number of Shares
     ------------------   -----------   ----------------
     15th January 2002     98,182,800         1,200
     28th January 2002    201,817,200         2,460
     15th February 2002   300,000,000         3,660
     15th March 2002      300,009,000         3,680

     Total                900,009,000        11,000

     On receipt of payment of the amounts specified in the above Schedule the
     Seller will deliver to the Purchaser the share certificates representing
     the number of shares set out opposite the payment.

1.2  If the Purchaser shall fail to make any of the payments after the 28th
     January

                                     - 1 -

<PAGE>

     within 7 days of the date set out in Clause 1.2 above the Seller shall no
     longer be obligated to sell, or transfer any of the shares to the Purchaser
     not already transferred by the Seller to the Purchaser.

1.3  Upon request from the Purchaser pursuant to the Commercial Code of Japan
     (Law No. 48. 9th March, 1899), as amended, BTJ shall change the
     Shareholders' Registration of BTJ to register the name and address of the
     Purchaser (or any Nominee of the Purchaser) as the owner of the 11,000
     Shares.

2.   Conditions Precedents

     The payment of the Purchase Price and the delivery of the Share Certificate
     as provided in Section 1 above shall be subject to the conditions as
     follows:

     (a)  The Seller has submitted to the Board of Directors of BTJ written
          request for the approval of the transfer of the 11,000 Shares from the
          Seller to the Purchaser pursuant hereto and the Board of Directors of
          BTJ has approved such transfer as requested; and

     (b)  The Stock Purchase Agreement executed on 30 November, 2001 among the
          Seller, BTJ and Neucom Corporation relating to the purchase and sale
          of the 11,000 Shares held by the Seller has been cancelled..

3.   Representations and Warranties

3.1  The Seller hereby represents and warrants that:

     (a)  The Seller is a corporation duly organised and validly existing under
          the laws of England and Wales;

     (b)  The Seller has all requisite corporate power to execute and deliver
          this Agreement and to perform its obligations hereunder, and all
          corporate

                                     - 2 -

<PAGE>

          actions on the part of the Seller necessary for the execution and
          delivery of this Agreement have been taken;

     (c)  The Seller has the full and complete legal title to the 11,000 Shares
          to be sold from the Seller to the Purchaser hereunder and there is no
          pledge, lien, mortgage or any other charge or interest for any third
          party, which would prevent the transfer of full and complete legal
          title to such Shares to the Purchaser;

     (d)  This Agreement constitutes a valid and legally binding obligations of
          the Seller enforceable against the Seller in accordance with its
          terms, except (a) as limited by applicable bankruptcy, insolvency,
          reorganisation and other laws of general application affecting
          enforcement of creditors' rights generally, and (b) as limited by laws
          relating to the availability of specific performance; and

     (e)  The sale of the Shares hereunder shall not constitute any violation
          and shall not be contradictory to any laws and regulations applicable
          to it and/or any agreement or instrument to which it is a party or to
          which it or its assets (including the Shares) are subject.

3.2  The Purchaser hereby represents and warrants that:

     (a)  The Purchaser is a corporation duly organised and validly existing
          under the laws of Japan;

     (b)  The Purchaser has all requisite corporate power to execute and deliver
          this Agreement and to perform its obligations hereunder, and all
          corporate actions on the part of the Purchaser necessary for the
          execution and delivery of this Agreement have been taken;

     (c)  This Agreement constitutes a valid and legally binding obligations of
          the Purchaser enforceable against the Purchaser in accordance with its
          terms, except (a) as limited by applicable bankruptcy, insolvency,
          reorganisation and other laws of general application affecting
          enforcement of creditors' rights generally, and (b) as limited by laws

                                     - 3 -

<PAGE>

          relating to the availability of specific performance; and

     (d)  The purchase of the Shares hereunder shall not constitute any
          violation and shall not be contradictory to any laws and regulations
          applicable to the Purchaser and/or any agreement to which he is a
          party or to which he or his assets (including the funds for the
          Purchase Price) are subject.

3.3  BTJ hereby represents and warrants that BTJ judged that the listing of the
     Shares on the "MOTHERS" section of the Tokyo Stock Exchange or any other
     Japanese stock exchange (including the NASDAQ Japan) or registration with
     the Japan Securities Dealers Association as over the counter registered
     stock (such listing or registration being hereinafter referred to as the
     "Listing") on or prior to 31March, 2002 shall not be feasible, and based on
     such judgment BTJ has not filed and will not file any application for the
     Listing to be accomplished on or prior to 31 March 2002.

4.   Covenants

4.1  The Seller hereby covenants that:

     (a)  The Seller shall keep holding of the 4,817.4 Shares, which shall
          remain with it (directly or indirectly through its wholly owned
          subsidiary) and shall not sell such Shares to any third party (except
          for the affiliates of the Seller) without written consent from the
          Purchaser as long as the Baltimore Franchise Agreement executed
          between the Seller and BTJ on November 30, 2001 (hereinafter referred
          to as "Baltimore Franchise Agreement ") is effective;

     (b)  When it is commercially reasonably necessary, the Seller shall make
          arm's length negotiation with BTJ to make commercially reasonable
          modification and revisions to the Baltimore Franchise Agreement from
          time to time;

     (c)  The Seller shall cast its votes at a General Shareholders Meeting of

                                     - 4 -

<PAGE>

          BTJ so that two or more but six or less persons nominated by the
          Purchaser shall be elected as Directors of BTJ, and the Seller shall
          cause all the BTJ's Directors appointed by the Seller and selected by
          BTJ to cast their votes at the Board of Directors Meeting of BTJ which
          is held to convene the aforementioned General Shareholders Meeting of
          BTJ so that BTJ will convene such General Shareholders Meeting. The
          Seller acknowledges and agrees that BTJ is currently scheduled to hold
          such Board of Directors Meeting on 17 January, 2002 and to hold such
          General Shareholders Meeting on 1 February, 2002, and shall cooperate
          with BTJ for such proceedings.

     (d)  The Seller shall make commercially reasonable effort to accomplish the
          Listing with the shareholding ratio in BTJ after the sale of the
          Shares after the Closing as soon as possible.

     (e)  The Seller shall execute a letter agreement in the form attached
          hereto as Appendix A (the "Letter of Retraction") and deliver the same
          to the Purchaser.

     (f)  In the event, BTJ wishes, for any reasonable financial reasons, to
          issue any new Shares to the Purchaser or any third party designated by
          BTJ at then proper current price, the Seller shall cast its votes on
          all Shares held by the Seller so that BTJ can issue such new Shares.
          Provided, however, that BTJ shall, upon request from the Seller, issue
          new Shares only to the extent the Seller can maintain its shareholding
          ratio of 19% in BTJ over the then all issued and outstanding Shares,
          and shall apply the unpaid accounts payable to the Seller to the
          consideration for such new Shares (by way of contribution in kind or
          otherwise in compliance with the Commercial Code of Japan), subject to
          approval of other shareholders of BTJ required by the Commercial Code
          of Japan and the feasibility of the then applicable laws.

     (g)  If requested by BTJ after the execution of this agreement, the Seller
          shall discuss the possibility of jointly developing businesses in Asia
          - Pacific area with BTJ and the Purchaser in commercially reasonable
          manners. For the avoidance of doubt, BTJ and the Purchaser confirm
          that the above discussion between the Seller and BTJ shall not have
          any exclusive nature

                                     - 5 -

<PAGE>

          or disturb the Seller's discussion with any other parties.

     (h)  If requested by BTJ the Seller shall cooperate with BTJ, in a
          commercially reasonable manners, in re-evaluating the book value of
          exclusivity rights on its balance sheet which was based on the
          Amendment of Sole-Strategic Value Added Reseller Agreement executed
          between the Seller and BTJ on March 18, 2000 so that such book value
          will reflect the proper fair price considering the various
          circumstance changes after the execution thereof.

4.2  BTJ hereby covenants that:

     (a)  BTJ shall, upon request from the Seller, immediately hold a meeting of
          its Board of Directors and to approve the purchase and sale of the
          Shares between the Seller and the Purchaser hereunder;

     (b)  BTJ shall commence to take procedures to convene a General
          Shareholders Meeting of BTJ immediately after the Closing to newly
          elect two or more but six or less Directors of BTJ as nominated by the
          Purchaser; and

     (c)  When it is commercially reasonably necessary, BTJ shall make arm's
          length negotiation with the Seller to make commercially reasonable
          modification and revisions to the Franchise Agreement (as hereinafter
          defined) from time to time.

4.3  The Purchaser hereby covenants that:

     (a)  The Purchaser shall assume toward the future the obligations of the
          Seller under the Subscription Agreement dated 9 March, 2000 between
          the Seller, BTJ (the "9 March Subscription Agreement") and the BTJ's
          shareholders and the Subscription Agreements dated 26 April, 2000
          between the Seller, BTJ and the strategic investors named therein
          pursuant to their terms and conditions as the successor and assigns of
          the Seller (except for the put option under the 9 March Subscription
          Agreement vis-a-vis the Non-individual Shareholder (as

                                     - 6 -

<PAGE>

          defined in the 9 March Subscription Agreement));

     (b)  The Purchaser shall not exercise voting rights or any other right
          (excluding the economical rights such as to receive dividends or
          distribution of the residual assets and to require the change in the
          shareholders registration of BTJ to reflect the sale of the Shares
          hereunder) as a shareholder of BTJ without permission by the Seller
          prior to the completion of the payment of the Purchase Price pursuant
          to Paragraph 1.2 hereof; and

     (c)  The Purchaser shall, if required by laws, submit to the Minister of
          Finance and the Minister of Economy, Trade and Industry through the
          Bank of Japan the notification relating to the capital transaction
          pursuant to the Foreign Exchange and Foreign Trade Law of Japan (Law
          No. 228, 1 December, 1949), as amended.

5.   Confidentiality

     The terms and conditions of this Agreement, and all discussions and
documents involved in the negotiation of this Agreement, are and shall remain
confidential, unless disclosure thereof is necessary in connection with the
listing of the Shares on the Tokyo Stock Exchange, or any public offering or
private placement of the Shares or pursuant to the request by the London Stock
Exchange, NASDAQ or the U.S. Securities Exchange Commission, or to any of the
other shareholders of BTJ or potential investors who show interest in purchasing
the Shares. BTJ and the Purchaser confirm that they agree to the release by
Baltimore of the Press Release at Appendix B. The confidentiality provisions of
this subsection shall survive for a period of two years after the date of this
Agreement.

6.   Notices

     Unless otherwise provided, any notice required or permitted under this
Agreement shall be given in writing and shall be deemed effectively given upon
personal delivery to the party to be notified or upon delivery by facsimile or
by courier

                                     - 7 -

<PAGE>

(air-courier if sent abroad) or upon deposit with any post office, by registered
mail (registered air-mail if sent abroad) addressed to the party to be notified
at the address indicated for such party in the very first paragraph of this
Agreement, or at such other address as such party may designate by 10 days'
advance written notice to the other parties.

7.   Expenses

     Regardless of whether or not the transactions contemplated by this
Agreement are consummated, each party shall bear his or its own fees and
expenses incurred in connection with such transactions.

8.   Survival of Warranties

     The warranties, representations and covenants of the parties hereto
contained in or made pursuant to this Agreement shall survive the execution and
delivery of this Agreement and the Closing and shall in no way be affected by
any investigation of the subject matter thereof made by or on behalf of the
Seller, the Purchaser and/or BTJ.

9.   Amendments and Waivers

     This Agreement may not be amended or supplemented except by written
agreement executed by the parties hereto. Any waiver of any provision, right or
remedy under this Agreement on any one or more occasions shall not constitute a
waiver of the same or any other provision, right or remedy under this Agreement
on any other occasion.

10.  Successors and Assigns

10.1 Except as otherwise provided herein, the terms and conditions of this
     Agreement shall inure to the benefit of and be binding upon the respective
     successors and assigns of the parties (including transferees of any
     Shares).

                                     - 8 -

<PAGE>

     Nothing in this Agreement, express or implied, is intended to confer upon
     any party other than the parties hereto or their respective successors and
     assigns any rights, remedies, obligations or liabilities under or by reason
     of this Agreement, except as expressly provided in this Agreement.

10.2 The Purchaser may transfer its status as the Purchaser hereunder to any
     investment fund or a business company nominated by it. As a condition
     precedent to such transfer, the Purchaser shall require such transferee to
     execute and deliver to the Seller written acknowledgement that such
     transferee shall be subject to the terms and conditions of this Agreement.

11.  Entire Agreement

     This Agreement and the documents referred to herein constitute the entire
agreement between the parties hereto with respect to the subject matter hereof
and no party shall be liable or bound to any other party in any manner by any
warranties, representations or covenants except as specifically set out herein
or therein.

12.  Governing Law and Settlement of Dispute.

12.1 This Agreement shall be governed by and construed in accordance with the
     laws of Japan.

12.2 Any legal action against any of the parties hereto relating to this
     Agreement, the construction of any provision of this Agreement or the
     rights, obligations or liabilities of any party hereunder shall be
     instituted in the Tokyo District Court and any Japanese court competent
     under Japanese law to hear appeals from such court to the jurisdiction of
     which the parties hereto expressly, unconditionally and irrevocably agree
     to submit.

IN WITNESS WHEREOF, the parties hereto have executed this Agreement as at the
date first above written.

                                     - 9 -

<PAGE>

                                         Baltimore Technologies plc
                                         Bijan Khezri


                                         ---------------------------------------
                                         Yasutaka Azuma


                                         CGI Limited.


                                         ---------------------------------------
                                         Denis kelly


                                         Baltimore Technologies Japan Co., Ltd.


                                         ---------------------------------------

                                     - 10 -

<PAGE>

                                   Appendix A

The Directors
CGI Limited
Kurihara Building
3F, 6-10 Nihonbashi
Chuo-Ku
103-0027 Tokyo
Japan

          , 2002
----------

Dear Sirs,

Baltimore Technologies plc - Letter dated 16 December 2001

With respect to the letter dated 16 December 2001 addressed to Baltimore
Technologies Japan Co. Ltd (the "Letter"), we hereby confirm we no longer wish
to terminate the Sole Strategic Value Added Reseller Agreement dated 17 May 1999
as amended on 9 March 2000 (the "SVAR Agreement") and/or the Baltimore Franchise
Agreement dated 30 November 2001 (the "Franchise Agreement") (together, "the
Agreements").

In consideration of your acquiring the 11,000 shares in the manner contemplated
by the Agreement dated 12 January 2002, we hereby confirm that the SVAR
Agreement and/or the Franchise Agreement will not be, nor will we treat them as,
terminated as a result of the Letter.

We confirm that the Agreements are to continue in force on exactly the same
terms as they did prior to the Letter being issued and we agree to fulfill our
obligations under the Agreements.

For the avoidance of doubt nothing in this letter should be taken as a waiver by
Baltimore to exercise it's rights of termination under the Agreements for any
breach of

                                     - 11 -

<PAGE>

the terms of those Agreements by BTJ arising after the signing of this letter.

This letter shall be governed by, and construed in accordance with, Japanese
law.

We would be grateful if you would confirm your agreement with the contents of
this letter by signing and returning the duplicate provided.

Yours sincerely,


--------------------------------------
Mr. Bijan Khezri
Chief Executive Officer
For and on behalf of Baltimore Technologies plc

We confirm receipt of your letter dated        , 2002 and our agreement with the
                                        -------
contents.


Signed
       -------------------------------
Mr.
For and on behalf of CGI Limited

Dated
      --------------------------------

                                     - 12 -

<PAGE>

Appendix B

      Baltimore Technologies plc to strengthen local ownership of Baltimore
                                Technolgies Japan

   Deeper involvement of local investors and partners key to Baltimore Japan's
                                 competitiveness

London, UK - XX January, 2002 - Baltimore Technologies plc (London: BLM) today
announced that it has exchanged contracts, with CGI Limited an investment fund
operating in Japan, Hong Kong and mainland China backing the interests of
Baltimore Technologies Japan's ("BTJ") management and partners for the sale by
Baltimore Technologies plc of 11,000 shares in BTJ for Yen 81,819 per share. The
total value of the transaction amounts to approximately 900 million yen
(approximately Stg (pound) xx million)

The sale of the shares has been structured as follows:

       Date          Purchase price (Yen)   Number of Shares
------------------   --------------------   ----------------
15th January 2002          98,182,800              1,200
28th January 2002         201,817,200              2,460
15th February 2002        300,000,000              3,660
15th March 2002           300,009,000              3,680

Total                     900,009,000             11,000

Once completed the shareholding of Baltimore Technologies plc in BTJ will be
reduced from 62% to a non-consolidating 19%. Current shareholders in BTJ include
Softbank, NTT

                                     - 13 -

<PAGE>

DoCoMo, Nikko Capital, Nomura and JAFCO Capital.

In March 2000, Baltimore Technologies plc acquired a 72.5% stake of its
exclusive reseller in the Japanese market, Network Solutions Japan (NSJ) to
create BTJ. In May 2000, CyberTrust Japan and its hosting operations in Sapporo
were merged into BTJ and Baltimore Technologies plc sold 2549 shares to various
Japanese financial institutions reducing its stake to 62.4%. BTJ holds a
twelve-year exclusive license for the distribution of Baltimore products in the
Japanese market and following this agreement will continue to promote and sell
Baltimore's e-security solutions in Japan. Customers of BTJ include Tokyo
Electric Power, NTT Communications, Sony, Industrial Bank of Japan and Fuji
Bank.

Commenting on the agreement, Bijan Khezri, Chief Executive Officer of Baltimore
Technologies plc, said, "It has always been our plan to strengthen the Japanese
operations through a deeper involvement by local Japanese investors and
strategic partners. Japanese business practices require a strong local majority
ownership to secure the competitive position of Baltimore's products in the
market. This transaction will allow Baltimore and BTJ to be a more aggressive
player in leading the contest for delivering e-security for e-Government and
e-finance in a significant and growing market."

Yasutaka Azuma, Chief Executive Officer of CGI Limited said, " We are taking
this stake in BTJ as a step to introducing more local strategic partners and
investors to further strengthen BTJ. We believe that the quality and depth of
Baltimore's technology and products gives it a strong competitive advantage in
the Japanese market. We look forward to working together with Baltimore
Technologies plc to exploit the growing market for e-security in Japan."

                                     - 14 -

<PAGE>

This transaction is part of the Baltimore Technologies plc's ongoing
restructuring strategy announced last year to refocus the Company on its core
areas of expertise.

"This transaction is a critical element of Baltimore's overall restructuring
process, in particular, facilitating a move towards an operating cost model
which is highly variable cost-centric. Whilst we are committed to our global
presence and brand, it is cost-effectiveness and local distribution as well as
innovation partnerships which will determine our long-term competitiveness,"
Khezri added.

Baltimore Japan currently employs 70 staff with annual revenue in excess of
Stg(pound)10 million. Baltimore Technologies' PKI-centred authentication
products are the only non-Japanese PKI products that are compliant with the
requirements of the Japanese Digital Signature legislation.

About Baltimore Technologies

                                     - 15 -