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