Commit Graph
3 Commits
Author SHA1 Message Date
Jeremy Barton 704d353bad Implement digest and HMAC on CommonCrypto
Digest algorithms: MD5, SHA1, SHA-2-256, SHA-2-384, SHA-2-512
HMAC algorithms: MD5, SHA1, SHA-2-256, SHA-2-384, SHA-2-512

The rough design:
* Use a single PAL identifier for the algorithm across digest and HMAC.
* The same identifier will be used in RSA
* Apple's hashing primitives require 3 exports per algorithm.
Instead of exposing them directly, make a shim-internal struct.
* Apple's HMAC primitives require re-asserting the algorithm ID on reset,
instead of persisting it in a managed field, just carry it in a shim-internal struct.

Regarding the identifiers.  While HMAC has an enum for algorithm ID,
and we could use the HMAC algorithm ID as our hash algorithm ID, the
identifiers for RSA signatures are different (for one, they're strings instead
of numbers).  The algorithm identifiers for RSA are further different in that
they use a single "SHA2" value for algorithm, then disambiguate
256/384/512 based on a second value (hash input size). That, combined
with many identifiers across their cryptography libraries being documented
as "may change in a future version" (to get people to use the constant
expression instead of just writing the literal value) resulted in identifiers
matching our (and Windows' and OpenSSL's) notion of an algorithm and
not trying to maintain semantic alignment for pass-through benefits.


Commit migrated from https://github.com/dotnet/corefx/commit/ae9e966eb7f41c5c2407a45f318b460d8c20d974
2016-08-23 08:46:15 -07:00
Christopher Costa aab016344e Fat package conversions
Commit migrated from https://github.com/dotnet/corefx/commit/be08afd9701053f5f9369762db58b87c8ca9559f
2016-03-10 16:15:19 -08:00
Jeremy Barton b4912ec0f5 Repartiton crypto contracts, and refresh the API set.
Some of the contracts were moved in their entirety:

System.Security.Cryptography.Encryption            => System.Security.Cryptography.Primitives
System.Security.Cryptography.Hashing               => System.Security.Cryptography.Primitives

System.Security.Cryptography.RandomNumberGenerator => System.Security.Cryptography.Algorithms
System.Security.Cryptography.Encryption.Aes        => System.Security.Cryptography.Algorithms
System.Security.Cryptography.Hashing.Algorithms    => System.Security.Cryptography.Algorithms
System.Security.Cryptography.DeriveBytes           => System.Security.Cryptography.Algorithms

The only partitioned library was System.Security.Cryptography.RSA:
  The RSA base class and supporting types                            => System.Security.Cryptography.Algorithms
  The RSACryptoServiceProvider class and additional supporting types => System.Security.Cryptography.Csp
  The internal RSAOpenSsl type was made public                       => System.Security.Cryptography.OpenSsl
  RSACng was copied from desktop                                     => System.Security.Cryptography.Cng

This change also pulls in the RSA contract refresh from 4.6.
It does not yet add RSA.Create() to do the right reflection-forward lookups (the change was already big enough)
It also has the sad side effect of turning off the RSA tests for Linux, but fixing that problem is high on my list after getting the packages published. (I wanted to keep as many files as possible intact so they show as moves both in TFS and on github... rename+edit in TFS will likely not show up as cleanly in git).
Git builds will continue to have test coverage, but with the old contracts disabled ToF tests will shut down.  ToF tests will be re-enabled in a followup change.

[tfs-changeset: 1505642]


Commit migrated from https://github.com/dotnet/corefx/commit/ce0506baea623efdb74707aee0e4aa169d6f468c
2015-07-24 08:13:47 -07:00