92 references to CoseHelpers
System.Security.Cryptography.Cose (92)
System\Security\Cryptography\Cose\CoseHeaderLabel.cs (2)
52
EncodedSize =
CoseHelpers
.GetIntegerEncodedSize(label);
69
EncodedSize =
CoseHelpers
.GetTextStringEncodedSize(label);
System\Security\Cryptography\Cose\CoseHeaderMap.cs (2)
394
encodedSize +=
CoseHelpers
.GetIntegerEncodedSize(algHeaderValueToSlip.Value);
397
encodedSize +=
CoseHelpers
.GetIntegerEncodedSize(mapLength);
System\Security\Cryptography\Cose\CoseMessage.cs (10)
23
internal static readonly int SizeOfSigStructureCtxSign =
CoseHelpers
.GetTextStringEncodedSize(SigStructureContextSign);
24
internal static readonly int SizeOfSigStructureCtxSign1 =
CoseHelpers
.GetTextStringEncodedSize(SigStructureContextSign1);
426
CoseHelpers
.WriteByteStringLength(hasher, (ulong)contentBytes.Length);
434
CoseHelpers
.WriteByteStringLength(hasher, (ulong)(contentStream.Length - contentStream.Position));
470
CoseHelpers
.WriteByteStringLength(hasher, (ulong)(content.Length - content.Position));
518
int encodedSize =
CoseHelpers
.SizeOfArrayOfLessThan24 +
519
CoseHelpers
.GetByteStringEncodedSize(bodyProtectedLength) +
520
CoseHelpers
.GetByteStringEncodedSize(associatedDataLength) +
521
CoseHelpers
.GetByteStringEncodedSize(contentLength);
526
CoseHelpers
.GetByteStringEncodedSize(signProtectedLength);
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (33)
384
int protectedMapBytesWritten =
CoseHelpers
.WriteHeaderMap(buffer, writer, protectedHeaders, isProtected: true, null);
387
CoseHelpers
.WriteHeaderMap(buffer.Slice(protectedMapBytesWritten), writer, unprotectedHeaders, isProtected: false, null);
389
CoseHelpers
.WriteContent(writer, content, isDetached);
410
int protectedMapBytesWritten =
CoseHelpers
.WriteHeaderMap(buffer, writer, protectedHeaders, isProtected: true, null);
413
CoseHelpers
.WriteHeaderMap(buffer.AsSpan(protectedMapBytesWritten), writer, unprotectedHeaders, isProtected: false, null);
414
CoseHelpers
.WriteContent(writer, default, isDetached: true);
457
int signProtectedBytesWritten =
CoseHelpers
.WriteHeaderMap(buffer, writer, signer._protectedHeaders, isProtected: true, signer._algHeaderValueToSlip);
459
CoseHelpers
.WriteHeaderMap(buffer.Slice(signProtectedBytesWritten), writer, signer.UnprotectedHeaders, isProtected: false, null);
464
CoseHelpers
.WriteSignature(buffer, hasher, writer, signer);
485
int signProtectedBytesWritten =
CoseHelpers
.WriteHeaderMap(buffer.AsSpan(start), writer, signer._protectedHeaders, isProtected: true, signer._algHeaderValueToSlip);
487
CoseHelpers
.WriteHeaderMap(buffer.AsSpan(start + signProtectedBytesWritten), writer, signer.UnprotectedHeaders, isProtected: false, null);
494
CoseHelpers
.WriteSignature(buffer, hasher, writer, signer);
504
int encodedSize = MultiSignSizeOfCborTag +
CoseHelpers
.SizeOfArrayOfLessThan24;
509
encodedSize +=
CoseHelpers
.GetByteStringEncodedSize(protectedHeadersSize);
521
encodedSize +=
CoseHelpers
.SizeOfNull;
525
encodedSize +=
CoseHelpers
.GetByteStringEncodedSize(contentLength);
528
encodedSize +=
CoseHelpers
.SizeOfArrayOfLessThan24;
529
encodedSize +=
CoseHelpers
.SizeOfArrayOfLessThan24;
530
encodedSize +=
CoseHelpers
.GetByteStringEncodedSize(CoseHeaderMap.ComputeEncodedSize(signer._protectedHeaders, signer._algHeaderValueToSlip));
532
encodedSize +=
CoseHelpers
.GetByteStringEncodedSize(
CoseHelpers
.ComputeSignatureSize(signer));
543
int encodedLength =
CoseHelpers
.GetCoseSignEncodedLengthMinusSignature(_isTagged, MultiSignSizeOfCborTag, _protectedHeaderAsBstr.Length, UnprotectedHeaders, _content);
544
encodedLength +=
CoseHelpers
.GetIntegerEncodedSize(Signatures.Count);
548
encodedLength +=
CoseHelpers
.SizeOfArrayOfLessThan24;
549
encodedLength +=
CoseHelpers
.GetByteStringEncodedSize(signature._encodedSignProtectedHeaders.Length);
551
encodedLength +=
CoseHelpers
.GetByteStringEncodedSize(signature._signature.Length);
603
CoseHelpers
.WriteHeaderMap(destination, writer, UnprotectedHeaders, isProtected: false, null);
605
CoseHelpers
.WriteContent(writer, Content.GetValueOrDefault().Span, !Content.HasValue);
618
CoseHelpers
.WriteHeaderMap(destination, writer, signature.UnprotectedHeaders, false, null);
793
byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength,
CoseHelpers
.ComputeSignatureSize(signer)));
804
bytesWritten =
CoseHelpers
.SignHash(signer, hasher, buffer);
869
byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength,
CoseHelpers
.ComputeSignatureSize(signer)));
877
bytesWritten =
CoseHelpers
.SignHash(signer, hasher, buffer);
System\Security\Cryptography\Cose\CoseSign1Message.cs (30)
327
int protectedMapBytesWritten =
CoseHelpers
.WriteHeaderMap(buffer, writer, signer._protectedHeaders, isProtected: true, signer._algHeaderValueToSlip);
330
CoseHelpers
.WriteHeaderMap(buffer.Slice(protectedMapBytesWritten), writer, signer._unprotectedHeaders, isProtected: false, null);
332
CoseHelpers
.WriteContent(writer, contentBytes, isDetached);
337
CoseHelpers
.WriteSignature(buffer, hasher, writer, signer);
350
int protectedMapBytesWritten =
CoseHelpers
.WriteHeaderMap(buffer, writer, signer._protectedHeaders, isProtected: true, signer._algHeaderValueToSlip);
353
CoseHelpers
.WriteHeaderMap(buffer.AsSpan(protectedMapBytesWritten), writer, signer._unprotectedHeaders, isProtected: false, null);
354
CoseHelpers
.WriteContent(writer, default, isDetached: true);
359
CoseHelpers
.WriteSignature(buffer, hasher, writer, signer);
406
return VerifyCore(key, _content, null, associatedData,
CoseHelpers
.GetKeyType(key));
448
return VerifyCore(key, _content, null, associatedData,
CoseHelpers
.GetKeyType(key));
496
return VerifyCore(key, detachedContent, null, associatedData,
CoseHelpers
.GetKeyType(key));
540
return VerifyCore(key, detachedContent, null, associatedData,
CoseHelpers
.GetKeyType(key));
606
return VerifyCore(key, default, detachedContent, associatedData,
CoseHelpers
.GetKeyType(key));
612
ReadOnlyMemory<byte> encodedAlg =
CoseHelpers
.GetCoseAlgorithmFromProtectedHeaders(ProtectedHeaders);
614
int? nullableAlg =
CoseHelpers
.DecodeCoseAlgorithmHeader(encodedAlg);
620
HashAlgorithmName hashAlgorithm =
CoseHelpers
.GetHashAlgorithmFromCoseAlgorithmAndKeyType(nullableAlg.Value, keyType, out RSASignaturePadding? padding);
707
return VerifyAsyncCore(key, detachedContent, associatedData,
CoseHelpers
.GetKeyType(key), cancellationToken);
712
ReadOnlyMemory<byte> encodedAlg =
CoseHelpers
.GetCoseAlgorithmFromProtectedHeaders(ProtectedHeaders);
714
int? nullableAlg =
CoseHelpers
.DecodeCoseAlgorithmHeader(encodedAlg);
720
HashAlgorithmName hashAlgorithm =
CoseHelpers
.GetHashAlgorithmFromCoseAlgorithmAndKeyType(nullableAlg.Value, keyType, out RSASignaturePadding? padding);
767
int encodedSize = Sign1SizeOfCborTag +
CoseHelpers
.SizeOfArrayOfLessThan24 +
768
CoseHelpers
.GetByteStringEncodedSize(CoseHeaderMap.ComputeEncodedSize(signer._protectedHeaders, signer._algHeaderValueToSlip)) +
773
encodedSize +=
CoseHelpers
.SizeOfNull;
777
encodedSize +=
CoseHelpers
.GetByteStringEncodedSize(contentLength);
780
encodedSize +=
CoseHelpers
.GetByteStringEncodedSize(
CoseHelpers
.ComputeSignatureSize(signer));
790
CoseHelpers
.GetCoseSignEncodedLengthMinusSignature(_isTagged, Sign1SizeOfCborTag, _protectedHeaderAsBstr.Length, UnprotectedHeaders, _content) +
791
CoseHelpers
.GetByteStringEncodedSize(_signature.Length);
826
CoseHelpers
.WriteHeaderMap(destination, writer, UnprotectedHeaders, isProtected: false, null);
828
CoseHelpers
.WriteContent(writer, Content.GetValueOrDefault().Span, !Content.HasValue);
System\Security\Cryptography\Cose\CoseSignature.cs (12)
112
return VerifyCore(key, Message.Content.Value.Span, null, associatedData,
CoseHelpers
.GetKeyType(key));
155
return VerifyCore(key, Message.Content.Value.Span, null, associatedData,
CoseHelpers
.GetKeyType(key));
204
return VerifyCore(key, detachedContent, null, associatedData,
CoseHelpers
.GetKeyType(key));
248
return VerifyCore(key, detachedContent, null, associatedData,
CoseHelpers
.GetKeyType(key));
315
return VerifyCore(key, default, detachedContent, associatedData,
CoseHelpers
.GetKeyType(key));
382
return VerifyAsyncCore(key, detachedContent, associatedData,
CoseHelpers
.GetKeyType(key), cancellationToken);
387
ReadOnlyMemory<byte> encodedAlg =
CoseHelpers
.GetCoseAlgorithmFromProtectedHeaders(ProtectedHeaders);
389
int? nullableAlg =
CoseHelpers
.DecodeCoseAlgorithmHeader(encodedAlg);
395
HashAlgorithmName hashAlgorithm =
CoseHelpers
.GetHashAlgorithmFromCoseAlgorithmAndKeyType(nullableAlg.Value, keyType, out RSASignaturePadding? padding);
421
ReadOnlyMemory<byte> encodedAlg =
CoseHelpers
.GetCoseAlgorithmFromProtectedHeaders(ProtectedHeaders);
422
int? nullableAlg =
CoseHelpers
.DecodeCoseAlgorithmHeader(encodedAlg);
428
HashAlgorithmName hashAlgorithm =
CoseHelpers
.GetHashAlgorithmFromCoseAlgorithmAndKeyType(nullableAlg.Value, keyType, out RSASignaturePadding? padding);
System\Security\Cryptography\Cose\CoseSigner.cs (3)
78
_keyType =
CoseHelpers
.GetKeyType(key);
118
_keyType =
CoseHelpers
.GetKeyType(key);
156
int? alg =
CoseHelpers
.DecodeCoseAlgorithmHeader(encodedAlg);