[Cryptography] Swift and cryptography

Arnold Reinhold agr at me.com
Tue Jun 10 08:20:29 EDT 2014


On Jun 9, 2014, at 12:52 PM, Phillip Hallam-Baker <phill at hallambaker.com> wrote:

> On Mon, Jun 9, 2014 at 7:30 AM, Arnold Reinhold <agr at me.com> wrote:
> ...
>> Swift is still in beta and there still might be time for the cryptography community to influence its design. Yes, I realize Swift is an Apple-only language at the moment, but this could change and getting things right on one platform is at least a start.
> 
> 
> Looks to me as if they have backported the most important parts of the
> C#/Java world to the C world.
> 
> What I want from a modern language is classes, single inheritance,
> interfaces, properties and a clean syntax that does not
> do::this.or->anything.worse

I think you may like Swift then. 

> 
> 
>> One area that comes to mind is some way to erase data that is guaranteed not be removed by the optimizer. Swift has destructors ("deinitializers") for classes. A guarantee that assignments in deinits would always be preserved might be a start. Swift also has "optional" variables that can either have a value or be nil. A zeroize generic function or protocol that erased all storage associated with an optional variable before setting it to nil could also be helpful.
> 
> It would be interesting to see how they manage strings. Do they
> support something like the C# 'protected' class...


"Protected" is for access control. The version of Swift that was just released does not have access controls but there are reports that Apple intends to add them (http://stackoverflow.com/questions/24003918/does-swift-have-access-modifiers). 

Are you thinking of .net's SecureString class? (http://msdn.microsoft.com/en-us/library/system.security.securestring(v=vs.110).aspx) I'm not aware of anything similar that Apple provides. It might be possible to write an equivalent class in Swift, assuming deinit can relied on to erase data. If not, it should be added to the crypto wish list. FWIW, I also found this in my searching: https://github.com/UrbanApps/UAObfuscatedString


Arnold Reinhold


More information about the cryptography mailing list