Born of Swedish parents in Adshikent, Azerbaijan, Hagelin attended Lundsberg boarding school and later studied mechanical engineering at the Royal Institute of Technology in Stockholm, graduating in 1914. He gained experience in engineering through work in Sweden and the United States.
His father Karl Wilhelm Hagelin worked for Nobel in Baku, but the family returned to Sweden after the Russian revolution. Karl Wilhelm was an investor in Arvid Gerhard Damm's company Aktiebolaget Cryptograph, established to sell rotor machines built using Damm's 1919 patent. Boris Hagelin was placed in the firm to represent the family investment. In 1925, Hagelin took over the firm, later reorganising it as Aktiebolaget Cryptoteknik in 1932. His machines competed with Scherbius' Enigma machines, but sold rather better.
At the beginning of World War II, Hagelin moved from Sweden to Switzerland, all the way across Germany and through Berlin to Genoa, carrying the design documents for the company's latest machine, and re-established his company there (it still operates as Crypto AG in Zug). That design was small, cheap and moderately secure, and he convinced the US military to adopt it. Many tens of thousands of them were made, and Hagelin became quite wealthy as a result. Hagelin fraudulently sold compromised machines to a variety of customers. Historian David Kahn has suggested that Hagelin was the only cypher-machine maker who ever became a millionaire.
- Boris CW Hagelin, The Story of the Hagelin Cryptos, Cryptologia, 18(3), July 1994, pp 204–242.
- Bengt Beckman. Codebreakers: Arne Beurling and the Swedish crypto program during World War II. Translated by Kjell-Ove Widman. Providence, RI: American Mathematical Society, c2002.