101 references to CoseAlgorithm
System.Security.Cryptography.Cose (101)
System\Security\Cryptography\Cose\CoseHeaderMap.cs (2)
332
internal static int Encode(CoseHeaderMap? map, Span<byte> destination, bool isProtected = false,
CoseAlgorithm
? algHeaderValueToSlip = null)
382
internal static int ComputeEncodedSize(CoseHeaderMap? map,
CoseAlgorithm
? algHeaderValueToSlip = null)
System\Security\Cryptography\Cose\CoseHelpers.cs (4)
136
internal static
CoseAlgorithm
? DecodeCoseAlgorithmHeader(ReadOnlyMemory<byte> encodedAlg)
155
CoseAlgorithm
coseAlg = CoseKey.CoseAlgorithmFromInt64(alg);
167
CoseAlgorithm
alg = CoseKey.CoseAlgorithmFromString(reader.ReadTextString());
199
internal static int WriteHeaderMap(Span<byte> buffer, CborWriter writer, CoseHeaderMap? headerMap, bool isProtected,
CoseAlgorithm
? algHeaderValueToSlip)
System\Security\Cryptography\Cose\CoseKey.cs (71)
15
internal
CoseAlgorithm
Algorithm { get; }
30
private CoseKey(KeyType keyType,
CoseAlgorithm
algorithm, HashAlgorithmName? hashAlgorithm)
43
CoseAlgorithm
coseAlgorithm = GetRSAAlgorithm(signaturePadding, hashAlgorithm);
56
CoseAlgorithm
coseAlgorithm = GetECDsaAlgorithm(hashAlgorithm);
68
CoseAlgorithm
coseAlgorithm = GetMLDsaAlgorithm(key.Algorithm);
74
internal static CoseKey FromUntrustedAlgorithmAndKey(
CoseAlgorithm
untrustedAlgorithm, IDisposable key)
80
CoseAlgorithm
.ES256 => FromKey(ecdsaKey, HashAlgorithmName.SHA256),
81
CoseAlgorithm
.ES384 => FromKey(ecdsaKey, HashAlgorithmName.SHA384),
82
CoseAlgorithm
.ES512 => FromKey(ecdsaKey, HashAlgorithmName.SHA512),
90
CoseAlgorithm
.RS256 => FromKey(rsaKey, RSASignaturePadding.Pkcs1, HashAlgorithmName.SHA256),
91
CoseAlgorithm
.RS384 => FromKey(rsaKey, RSASignaturePadding.Pkcs1, HashAlgorithmName.SHA384),
92
CoseAlgorithm
.RS512 => FromKey(rsaKey, RSASignaturePadding.Pkcs1, HashAlgorithmName.SHA512),
93
CoseAlgorithm
.PS256 => FromKey(rsaKey, RSASignaturePadding.Pss, HashAlgorithmName.SHA256),
94
CoseAlgorithm
.PS384 => FromKey(rsaKey, RSASignaturePadding.Pss, HashAlgorithmName.SHA384),
95
CoseAlgorithm
.PS512 => FromKey(rsaKey, RSASignaturePadding.Pss, HashAlgorithmName.SHA512),
104
CoseAlgorithm
.MLDsa44 => FromKeyWithExpectedAlgorithm(MLDsaAlgorithm.MLDsa44, mldsaKey),
105
CoseAlgorithm
.MLDsa65 => FromKeyWithExpectedAlgorithm(MLDsaAlgorithm.MLDsa65, mldsaKey),
106
CoseAlgorithm
.MLDsa87 => FromKeyWithExpectedAlgorithm(MLDsaAlgorithm.MLDsa87, mldsaKey),
120
internal static
CoseAlgorithm
CoseAlgorithmFromInt64(long alg)
127
CoseAlgorithm
coseAlgorithm = (
CoseAlgorithm
)alg;
133
private static void ThrowIfCoseAlgorithmNotSupported(
CoseAlgorithm
alg)
136
if (alg !=
CoseAlgorithm
.ES256 &&
137
alg !=
CoseAlgorithm
.ES384 &&
138
alg !=
CoseAlgorithm
.ES512 &&
139
alg !=
CoseAlgorithm
.PS256 &&
140
alg !=
CoseAlgorithm
.PS384 &&
141
alg !=
CoseAlgorithm
.PS512 &&
142
alg !=
CoseAlgorithm
.RS256 &&
143
alg !=
CoseAlgorithm
.RS384 &&
144
alg !=
CoseAlgorithm
.RS512 &&
145
alg !=
CoseAlgorithm
.MLDsa44 &&
146
alg !=
CoseAlgorithm
.MLDsa65 &&
147
alg !=
CoseAlgorithm
.MLDsa87)
154
internal static
CoseAlgorithm
CoseAlgorithmFromString(string algString)
159
nameof(
CoseAlgorithm
.ES256) =>
CoseAlgorithm
.ES256,
160
nameof(
CoseAlgorithm
.ES384) =>
CoseAlgorithm
.ES384,
161
nameof(
CoseAlgorithm
.ES512) =>
CoseAlgorithm
.ES512,
162
nameof(
CoseAlgorithm
.PS256) =>
CoseAlgorithm
.PS256,
163
nameof(
CoseAlgorithm
.PS384) =>
CoseAlgorithm
.PS384,
164
nameof(
CoseAlgorithm
.PS512) =>
CoseAlgorithm
.PS512,
165
nameof(
CoseAlgorithm
.RS256) =>
CoseAlgorithm
.RS256,
166
nameof(
CoseAlgorithm
.RS384) =>
CoseAlgorithm
.RS384,
167
nameof(
CoseAlgorithm
.RS512) =>
CoseAlgorithm
.RS512,
169
"ML-DSA-44" =>
CoseAlgorithm
.MLDsa44,
170
"ML-DSA-65" =>
CoseAlgorithm
.MLDsa65,
171
"ML-DSA-87" =>
CoseAlgorithm
.MLDsa87,
271
private static
CoseAlgorithm
GetRSAAlgorithm(RSASignaturePadding signaturePadding, HashAlgorithmName hashAlgorithm)
279
nameof(HashAlgorithmName.SHA256) =>
CoseAlgorithm
.PS256,
280
nameof(HashAlgorithmName.SHA384) =>
CoseAlgorithm
.PS384,
281
nameof(HashAlgorithmName.SHA512) =>
CoseAlgorithm
.PS512,
290
nameof(HashAlgorithmName.SHA256) =>
CoseAlgorithm
.RS256,
291
nameof(HashAlgorithmName.SHA384) =>
CoseAlgorithm
.RS384,
292
nameof(HashAlgorithmName.SHA512) =>
CoseAlgorithm
.RS512,
297
private static
CoseAlgorithm
GetECDsaAlgorithm(HashAlgorithmName hashAlgorithm)
301
nameof(HashAlgorithmName.SHA256) =>
CoseAlgorithm
.ES256,
302
nameof(HashAlgorithmName.SHA384) =>
CoseAlgorithm
.ES384,
303
nameof(HashAlgorithmName.SHA512) =>
CoseAlgorithm
.ES512,
309
private static
CoseAlgorithm
GetMLDsaAlgorithm(MLDsaAlgorithm algorithm)
313
return
CoseAlgorithm
.MLDsa44;
317
return
CoseAlgorithm
.MLDsa65;
321
return
CoseAlgorithm
.MLDsa87;
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (2)
768
CoseAlgorithm
? algHeaderValueToSlip = signer._algHeaderValueToSlip;
844
CoseAlgorithm
? algHeaderValueToSlip = signer._algHeaderValueToSlip;
System\Security\Cryptography\Cose\CoseSign1Message.cs (9)
394
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
437
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
522
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
566
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
669
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
739
CoseAlgorithm
? nullableAlg = CoseHelpers.DecodeCoseAlgorithmHeader(encodedAlg);
836
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
1002
private
CoseAlgorithm
GetCoseAlgorithmFromProtectedHeaders()
1006
CoseAlgorithm
? nullableAlg = CoseHelpers.DecodeCoseAlgorithmHeader(encodedAlg);
System\Security\Cryptography\Cose\CoseSignature.cs (8)
109
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
192
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
238
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
282
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
387
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
510
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
639
private
CoseAlgorithm
GetCoseAlgorithmFromProtectedHeaders()
643
CoseAlgorithm
? nullableAlg = CoseHelpers.DecodeCoseAlgorithmHeader(encodedAlg);
System\Security\Cryptography\Cose\CoseSigner.cs (5)
14
internal readonly
CoseAlgorithm
? _algHeaderValueToSlip;
164
internal
CoseAlgorithm
? ValidateOrSlipAlgorithmHeader()
166
CoseAlgorithm
algHeaderValue = CoseKey.Algorithm;
182
private void ValidateAlgorithmHeader(ReadOnlyMemory<byte> encodedAlg,
CoseAlgorithm
expectedAlg)
184
CoseAlgorithm
? alg = CoseHelpers.DecodeCoseAlgorithmHeader(encodedAlg);