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