3

Im trying to use the CryptoCommon class but unable the find it in the monotuch assembly.

I found the assembly Mono.Security.Cryptography, does it have the same performance as the CryptoCommon class?

Thanks!!

poupou
  • 43,413
  • 6
  • 77
  • 174
IturPablo
  • 1,572
  • 2
  • 22
  • 35

1 Answers1

1

CommonCrypto is used internally inside Xamarin.iOS, this is not something extra - i.e. there's no need to opt-in or opt-out.

What it means is that it's use is totally transparent to your code. If an algorithm is available in CommonCrypto then using the classic .NET type will use it.

E.g.

// this will use CommonCrypto. AES is supported by CommonCrypto
// if your device supports it AES can be hardware accelerated
var aes = Aes.Create (); 

// this will also use CommonCrypto. SHA-1 is supported by CommonCrypto
// if your device supports it SHA-1 can be hardware accelerated
var sha = new SHA1Managed (); 

// this will not use CommonCrypto since the algorithm is not supported by Apple
var r = RIPEMD160.Create (); 

More information about CommonCrypto can be found on my blog.

poupou
  • 43,413
  • 6
  • 77
  • 174
  • Thanks u so much, I was actually looking at your blog already. I have to encrypt images in order to meet HIPAA regulations, which cypher algorithm do you consider is best in this situation? – IturPablo Feb 21 '14 at 14:37
  • 1
    I've **never** read the HIPAA regulations so I do **not** know their requirements. Today most people use AES to encrypt data (128 to 256 bits) but the most important thing is *often* the key management (not the encryption itself). – poupou Feb 21 '14 at 15:32