97 references to CoseAlgorithm
System.Security.Cryptography.Cose (97)
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 (67)
15
internal
CoseAlgorithm
Algorithm { get; }
69
internal static CoseKey FromUntrustedAlgorithmAndKey(
CoseAlgorithm
untrustedAlgorithm, IDisposable key)
75
CoseAlgorithm
.ES256 => new CoseKey(ecdsaKey, HashAlgorithmName.SHA256),
76
CoseAlgorithm
.ES384 => new CoseKey(ecdsaKey, HashAlgorithmName.SHA384),
77
CoseAlgorithm
.ES512 => new CoseKey(ecdsaKey, HashAlgorithmName.SHA512),
85
CoseAlgorithm
.RS256 => new CoseKey(rsaKey, RSASignaturePadding.Pkcs1, HashAlgorithmName.SHA256),
86
CoseAlgorithm
.RS384 => new CoseKey(rsaKey, RSASignaturePadding.Pkcs1, HashAlgorithmName.SHA384),
87
CoseAlgorithm
.RS512 => new CoseKey(rsaKey, RSASignaturePadding.Pkcs1, HashAlgorithmName.SHA512),
88
CoseAlgorithm
.PS256 => new CoseKey(rsaKey, RSASignaturePadding.Pss, HashAlgorithmName.SHA256),
89
CoseAlgorithm
.PS384 => new CoseKey(rsaKey, RSASignaturePadding.Pss, HashAlgorithmName.SHA384),
90
CoseAlgorithm
.PS512 => new CoseKey(rsaKey, RSASignaturePadding.Pss, HashAlgorithmName.SHA512),
99
CoseAlgorithm
.MLDsa44 => FromKeyWithExpectedAlgorithm(MLDsaAlgorithm.MLDsa44, mldsaKey),
100
CoseAlgorithm
.MLDsa65 => FromKeyWithExpectedAlgorithm(MLDsaAlgorithm.MLDsa65, mldsaKey),
101
CoseAlgorithm
.MLDsa87 => FromKeyWithExpectedAlgorithm(MLDsaAlgorithm.MLDsa87, mldsaKey),
115
internal static
CoseAlgorithm
CoseAlgorithmFromInt64(long alg)
122
CoseAlgorithm
coseAlgorithm = (
CoseAlgorithm
)alg;
128
private static void ThrowIfCoseAlgorithmNotSupported(
CoseAlgorithm
alg)
131
if (alg is not
CoseAlgorithm
.ES256 and
132
not
CoseAlgorithm
.ES384 and
133
not
CoseAlgorithm
.ES512 and
134
not
CoseAlgorithm
.PS256 and
135
not
CoseAlgorithm
.PS384 and
136
not
CoseAlgorithm
.PS512 and
137
not
CoseAlgorithm
.RS256 and
138
not
CoseAlgorithm
.RS384 and
139
not
CoseAlgorithm
.RS512 and
140
not
CoseAlgorithm
.MLDsa44 and
141
not
CoseAlgorithm
.MLDsa65 and
142
not
CoseAlgorithm
.MLDsa87)
149
internal static
CoseAlgorithm
CoseAlgorithmFromString(string algString)
154
nameof(
CoseAlgorithm
.ES256) =>
CoseAlgorithm
.ES256,
155
nameof(
CoseAlgorithm
.ES384) =>
CoseAlgorithm
.ES384,
156
nameof(
CoseAlgorithm
.ES512) =>
CoseAlgorithm
.ES512,
157
nameof(
CoseAlgorithm
.PS256) =>
CoseAlgorithm
.PS256,
158
nameof(
CoseAlgorithm
.PS384) =>
CoseAlgorithm
.PS384,
159
nameof(
CoseAlgorithm
.PS512) =>
CoseAlgorithm
.PS512,
160
nameof(
CoseAlgorithm
.RS256) =>
CoseAlgorithm
.RS256,
161
nameof(
CoseAlgorithm
.RS384) =>
CoseAlgorithm
.RS384,
162
nameof(
CoseAlgorithm
.RS512) =>
CoseAlgorithm
.RS512,
164
"ML-DSA-44" =>
CoseAlgorithm
.MLDsa44,
165
"ML-DSA-65" =>
CoseAlgorithm
.MLDsa65,
166
"ML-DSA-87" =>
CoseAlgorithm
.MLDsa87,
268
private static
CoseAlgorithm
GetRSAAlgorithm(RSASignaturePadding signaturePadding, HashAlgorithmName hashAlgorithm)
276
nameof(HashAlgorithmName.SHA256) =>
CoseAlgorithm
.PS256,
277
nameof(HashAlgorithmName.SHA384) =>
CoseAlgorithm
.PS384,
278
nameof(HashAlgorithmName.SHA512) =>
CoseAlgorithm
.PS512,
287
nameof(HashAlgorithmName.SHA256) =>
CoseAlgorithm
.RS256,
288
nameof(HashAlgorithmName.SHA384) =>
CoseAlgorithm
.RS384,
289
nameof(HashAlgorithmName.SHA512) =>
CoseAlgorithm
.RS512,
294
private static
CoseAlgorithm
GetECDsaAlgorithm(HashAlgorithmName hashAlgorithm)
298
nameof(HashAlgorithmName.SHA256) =>
CoseAlgorithm
.ES256,
299
nameof(HashAlgorithmName.SHA384) =>
CoseAlgorithm
.ES384,
300
nameof(HashAlgorithmName.SHA512) =>
CoseAlgorithm
.ES512,
306
private static
CoseAlgorithm
GetMLDsaAlgorithm(MLDsaAlgorithm algorithm)
310
return
CoseAlgorithm
.MLDsa44;
314
return
CoseAlgorithm
.MLDsa65;
318
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();
603
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
706
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
776
CoseAlgorithm
? nullableAlg = CoseHelpers.DecodeCoseAlgorithmHeader(encodedAlg);
873
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
1039
private
CoseAlgorithm
GetCoseAlgorithmFromProtectedHeaders()
1043
CoseAlgorithm
? nullableAlg = CoseHelpers.DecodeCoseAlgorithmHeader(encodedAlg);
System\Security\Cryptography\Cose\CoseSignature.cs (8)
109
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
192
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
238
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
319
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
424
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
547
CoseAlgorithm
coseAlgorithm = GetCoseAlgorithmFromProtectedHeaders();
676
private
CoseAlgorithm
GetCoseAlgorithmFromProtectedHeaders()
680
CoseAlgorithm
? nullableAlg = CoseHelpers.DecodeCoseAlgorithmHeader(encodedAlg);
System\Security\Cryptography\Cose\CoseSigner.cs (5)
14
internal readonly
CoseAlgorithm
? _algHeaderValueToSlip;
155
internal
CoseAlgorithm
? ValidateOrSlipAlgorithmHeader()
157
CoseAlgorithm
algHeaderValue = CoseKey.Algorithm;
173
private void ValidateAlgorithmHeader(ReadOnlyMemory<byte> encodedAlg,
CoseAlgorithm
expectedAlg)
175
CoseAlgorithm
? alg = CoseHelpers.DecodeCoseAlgorithmHeader(encodedAlg);