Use ROS<byte> instead of byte[] where it makes sense on S.S.C.Cose (#66741)
authorDavid CantĂș <dacantu@microsoft.com>
Fri, 1 Apr 2022 06:00:28 +0000 (23:00 -0700)
committerGitHub <noreply@github.com>
Fri, 1 Apr 2022 06:00:28 +0000 (23:00 -0700)
commit321cec85d91ce2edf7476f960b4c3d037c2da2ad
tree5451a5126f20328694bd08a4730f3411177fd8ed
parent3cec42fad2352222fd70e6e95e9bf4720537ed87
Use ROS<byte> instead of byte[] where it makes sense on S.S.C.Cose (#66741)

* Use ROS<byte> instead of byte[] on S.S.C.Cose

* Add TrySign and improve Sign implementation to use less byte[]

* Add TrySign tests

* Address using scope feedback

* Address src feedback

* Refactor tests to avoid duplicated ones

* Remove invalid asserts in Crypto code

* Fix 'new()' without the type on the left-hand side

* Fix ThreadStatic issues in tests

* * Don't use ArrayPool in SignCore
* Add comment describing reusability of encoded protected headers
* Cache toBeSigned

* Don't cache toBeSigned for detached content

* Address nits in tests
12 files changed:
src/libraries/System.Security.Cryptography.Cose/ref/System.Security.Cryptography.Cose.cs
src/libraries/System.Security.Cryptography.Cose/src/System.Security.Cryptography.Cose.csproj
src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderLabel.cs
src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderMap.cs
src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHelpers.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseMessage.cs
src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseSign1Message.cs
src/libraries/System.Security.Cryptography.Cose/tests/CoseSign1MessageTests.Sign.CustomHeaderMaps.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Cose/tests/CoseSign1MessageTests.Sign.cs
src/libraries/System.Security.Cryptography.Cose/tests/CoseSign1MessageTests.Verify.cs
src/libraries/System.Security.Cryptography.Cose/tests/CoseTestHelpers.cs
src/libraries/System.Security.Cryptography.Cose/tests/System.Security.Cryptography.Cose.Tests.csproj