From f32b1fe3c2054cbe59b6eeabababd79eb1b55170 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Tue, 10 Nov 2020 14:54:10 +0100 Subject: [PATCH 1/8] Add missing XML docs to System.Security.* --- .../Cryptography/Rfc2898DeriveBytes.cs | 3 + .../Pkcs/Rfc3161TimestampTokenInfo.cs | 81 +++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs index 395a42352f88c..a8b9ac8643cc7 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs @@ -27,6 +27,9 @@ public class Rfc2898DeriveBytes : DeriveBytes private int _startIndex; private int _endIndex; + /// + /// Gets the hash algorithm used for byte derivation + /// public HashAlgorithmName HashAlgorithm { get; } public Rfc2898DeriveBytes(byte[] password, byte[] salt, int iterations) diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs index b5f87e5513338..34df742582120 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs @@ -12,6 +12,9 @@ namespace System.Security.Cryptography.Pkcs { + /// + /// Represents time stamp token info class defined in RFC3161 as TSTInfo. + /// public sealed class Rfc3161TimestampTokenInfo { private readonly byte[] _encodedBytes; @@ -20,6 +23,20 @@ public sealed class Rfc3161TimestampTokenInfo private Oid? _hashAlgorithmId; private ReadOnlyMemory? _tsaNameBytes; + /// + /// Initializes a new instance of the Rfc3161TimestampTokenInfo class. + /// + /// An OID representing TSA's policy under which the response was produced. + /// A hash algorithm OID of the data to be time-stamped./param> + /// A hash value of the data to be time-stamped. + /// An integer assigned by the TSA to the . + /// Timestamp encoded in the token. + /// Accuracy with which is compared. Also see . + /// true to ensure that every time-stamp token from the same TSA can always be ordered based on the , regardless of the accuracy; false to make indicate when token has been created by the TSA. + /// An arbitrary number that can be used only once. Using a nonce always allows to detect replays, and hence its use is recommended. + /// Hint in the TSA name identification. The actual identification of the entity that signed the response will always occur through the use of the certificate identifier. + /// Collection of X509 extensions. + /// If hash OID, message hash, policy or nonce is present in the , then the same value should be used. If is not provided, then the accuracy may be available through other means such as i.e. policy. public Rfc3161TimestampTokenInfo( Oid policyId, Oid hashAlgorithmId, @@ -57,17 +74,62 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) _parsedData = tstInfo; } + /// + /// version of the Time-Stamp request. + /// public int Version => _parsedData.Version; + + /// + /// An OID representing TSA's policy under which the response was produced. + /// public Oid PolicyId => (_policyOid ??= new Oid(_parsedData.Policy, null)); + + /// + /// An OID of the hash algorithm. + /// public Oid HashAlgorithmId => (_hashAlgorithmId ??= new Oid(_parsedData.MessageImprint.HashAlgorithm.Algorithm, null)); + + /// + /// Data representing message hash. + /// public ReadOnlyMemory GetMessageHash() => _parsedData.MessageImprint.HashedMessage; + + /// + /// An integer assigned by the TSA to the . + /// public ReadOnlyMemory GetSerialNumber() => _parsedData.SerialNumber; + + /// + /// Timestamp encoded in the token. + /// public DateTimeOffset Timestamp => _parsedData.GenTime; + + /// + /// Accuracy with which is compared. Also see . + /// public long? AccuracyInMicroseconds => _parsedData.Accuracy?.TotalMicros; + + /// + /// Gets a value indicating if every time-stamp token from the same TSA can always be ordered based on the , regardless of the accuracy; If false indicate when token has been created by the TSA. + /// public bool IsOrdering => _parsedData.Ordering; + + /// + /// An arbitrary number that can be used only once. + /// public ReadOnlyMemory? GetNonce() => _parsedData.Nonce; + + /// + /// Gets a value indicating whether there are any X509 extensions. + /// public bool HasExtensions => _parsedData.Extensions?.Length > 0; + /// + /// Gets data representing hint in the TSA name identification. + /// The actual identification of the entity that signed the response + /// will always occur through the use of the certificate identifier (ESSCertID Attribute) + /// inside a SigningCertificate attribute which is part of the signer info. + /// public ReadOnlyMemory? GetTimestampAuthorityName() { if (_tsaNameBytes == null) @@ -88,6 +150,9 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) return _tsaNameBytes.Value; } + /// + /// Returns collection of X509 certificates. + /// public X509ExtensionCollection GetExtensions() { var coll = new X509ExtensionCollection(); @@ -115,11 +180,20 @@ public X509ExtensionCollection GetExtensions() return coll; } + /// + /// Returns byte array representing ASN.1 encoded data. + /// public byte[] Encode() { return _encodedBytes.CloneByteArray(); } + /// + /// Gets ASN.1 encoded data. + /// + /// Destination buffer. + /// Outputs bytes written to destination buffer. + /// true if operation succeeded; false if buffer size was insufficient. public bool TryEncode(Span destination, out int bytesWritten) { if (destination.Length < _encodedBytes.Length) @@ -133,6 +207,13 @@ public bool TryEncode(Span destination, out int bytesWritten) return true; } + /// + /// Decodes ASN.1 encoded data. + /// + /// Input or source buffer. + /// Class representing decoded data or null when data could not be decoded. + /// Number of bytes used for decoding. + /// true if operation succeeded; false otherwise. public static bool TryDecode( ReadOnlyMemory source, [NotNullWhen(true)] out Rfc3161TimestampTokenInfo? timestampTokenInfo, From 0db7d7b2ec1a687560eb95dc0177548faef64649 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Tue, 10 Nov 2020 19:38:52 +0100 Subject: [PATCH 2/8] add missing < --- .../Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs index 34df742582120..81c180e57b70f 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs @@ -27,7 +27,7 @@ public sealed class Rfc3161TimestampTokenInfo /// Initializes a new instance of the Rfc3161TimestampTokenInfo class. /// /// An OID representing TSA's policy under which the response was produced. - /// A hash algorithm OID of the data to be time-stamped./param> + /// A hash algorithm OID of the data to be time-stamped. /// A hash value of the data to be time-stamped. /// An integer assigned by the TSA to the . /// Timestamp encoded in the token. From 110071152abaf7e105902beeb8f0e18500ab902b Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Wed, 11 Nov 2020 19:54:40 +0100 Subject: [PATCH 3/8] Apply suggestions from code review Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com> --- .../Cryptography/Rfc2898DeriveBytes.cs | 2 +- .../Pkcs/Rfc3161TimestampTokenInfo.cs | 58 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs index a8b9ac8643cc7..b6e615e2b880c 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs @@ -28,7 +28,7 @@ public class Rfc2898DeriveBytes : DeriveBytes private int _endIndex; /// - /// Gets the hash algorithm used for byte derivation + /// Gets the hash algorithm used for byte derivation. /// public HashAlgorithmName HashAlgorithm { get; } diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs index 81c180e57b70f..8bc0ac93684f5 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs @@ -13,7 +13,7 @@ namespace System.Security.Cryptography.Pkcs { /// - /// Represents time stamp token info class defined in RFC3161 as TSTInfo. + /// Represents the timestamp token information class defined in RFC3161 as TSTInfo. /// public sealed class Rfc3161TimestampTokenInfo { @@ -24,19 +24,19 @@ public sealed class Rfc3161TimestampTokenInfo private ReadOnlyMemory? _tsaNameBytes; /// - /// Initializes a new instance of the Rfc3161TimestampTokenInfo class. + /// Initializes a new instance of the class with the specified parameters. /// - /// An OID representing TSA's policy under which the response was produced. - /// A hash algorithm OID of the data to be time-stamped. - /// A hash value of the data to be time-stamped. + /// An OID representing the TSA's policy under which the response was produced. + /// A hash algorithm OID of the data to be timestamped. + /// A hash value of the data to be timestamped. /// An integer assigned by the TSA to the . - /// Timestamp encoded in the token. - /// Accuracy with which is compared. Also see . - /// true to ensure that every time-stamp token from the same TSA can always be ordered based on the , regardless of the accuracy; false to make indicate when token has been created by the TSA. + /// The timestamp encoded in the token. + /// The accuracy with which is compared. Also see . + /// to ensure that every timestamp token from the same TSA can always be ordered based on the , regardless of the accuracy; to make indicate when token has been created by the TSA. /// An arbitrary number that can be used only once. Using a nonce always allows to detect replays, and hence its use is recommended. - /// Hint in the TSA name identification. The actual identification of the entity that signed the response will always occur through the use of the certificate identifier. - /// Collection of X509 extensions. - /// If hash OID, message hash, policy or nonce is present in the , then the same value should be used. If is not provided, then the accuracy may be available through other means such as i.e. policy. + /// The hint in the TSA name identification. The actual identification of the entity that signed the response will always occur through the use of the certificate identifier. + /// A collection of X509 extensions. + /// If , , or are present in the , then the same value should be used. If is not provided, then the accuracy may be available through other means such as i.e. . public Rfc3161TimestampTokenInfo( Oid policyId, Oid hashAlgorithmId, @@ -75,12 +75,12 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) } /// - /// version of the Time-Stamp request. + /// The version of the timestamp request. /// public int Version => _parsedData.Version; /// - /// An OID representing TSA's policy under which the response was produced. + /// An OID representing the TSA's policy under which the response was produced. /// public Oid PolicyId => (_policyOid ??= new Oid(_parsedData.Policy, null)); @@ -90,7 +90,7 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) public Oid HashAlgorithmId => (_hashAlgorithmId ??= new Oid(_parsedData.MessageImprint.HashAlgorithm.Algorithm, null)); /// - /// Data representing message hash. + /// The data representing the message hash. /// public ReadOnlyMemory GetMessageHash() => _parsedData.MessageImprint.HashedMessage; @@ -100,17 +100,17 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) public ReadOnlyMemory GetSerialNumber() => _parsedData.SerialNumber; /// - /// Timestamp encoded in the token. + /// The timestamp encoded in the token. /// public DateTimeOffset Timestamp => _parsedData.GenTime; /// - /// Accuracy with which is compared. Also see . + /// The accuracy with which is compared. Also see . /// public long? AccuracyInMicroseconds => _parsedData.Accuracy?.TotalMicros; /// - /// Gets a value indicating if every time-stamp token from the same TSA can always be ordered based on the , regardless of the accuracy; If false indicate when token has been created by the TSA. + /// Gets a value indicating if every timestamp token from the same TSA can always be ordered based on the , regardless of the accuracy; If , indicates when the token has been created by the TSA. /// public bool IsOrdering => _parsedData.Ordering; @@ -125,7 +125,7 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) public bool HasExtensions => _parsedData.Extensions?.Length > 0; /// - /// Gets data representing hint in the TSA name identification. + /// Gets the data representing the hint in the TSA name identification. /// The actual identification of the entity that signed the response /// will always occur through the use of the certificate identifier (ESSCertID Attribute) /// inside a SigningCertificate attribute which is part of the signer info. @@ -151,7 +151,7 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) } /// - /// Returns collection of X509 certificates. + /// Returns a collection of X509 certificates. /// public X509ExtensionCollection GetExtensions() { @@ -181,7 +181,7 @@ public X509ExtensionCollection GetExtensions() } /// - /// Returns byte array representing ASN.1 encoded data. + /// Returns a byte array representing ASN.1 encoded data. /// public byte[] Encode() { @@ -189,11 +189,11 @@ public byte[] Encode() } /// - /// Gets ASN.1 encoded data. + /// Gets the ASN.1 encoded data. /// - /// Destination buffer. - /// Outputs bytes written to destination buffer. - /// true if operation succeeded; false if buffer size was insufficient. + /// The destination buffer. + /// When this method returns , contains the bytes written to the buffer. + /// if the operation succeeded; if the buffer size was insufficient. public bool TryEncode(Span destination, out int bytesWritten) { if (destination.Length < _encodedBytes.Length) @@ -208,12 +208,12 @@ public bool TryEncode(Span destination, out int bytesWritten) } /// - /// Decodes ASN.1 encoded data. + /// Decodes the ASN.1 encoded data. /// - /// Input or source buffer. - /// Class representing decoded data or null when data could not be decoded. - /// Number of bytes used for decoding. - /// true if operation succeeded; false otherwise. + /// The input or source buffer. + /// When this method returns , the decoded data. When this method returns , the value is , meaning the data could not be decoded. + /// The number of bytes used for decoding. + /// if the operation succeeded; otherwise. public static bool TryDecode( ReadOnlyMemory source, [NotNullWhen(true)] out Rfc3161TimestampTokenInfo? timestampTokenInfo, From 9b44ddbe82bba233f99958a99321c70404036157 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Thu, 12 Nov 2020 09:52:57 +0100 Subject: [PATCH 4/8] Update src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com> --- .../Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs index 8bc0ac93684f5..389e97fba8b77 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs @@ -37,6 +37,7 @@ public sealed class Rfc3161TimestampTokenInfo /// The hint in the TSA name identification. The actual identification of the entity that signed the response will always occur through the use of the certificate identifier. /// A collection of X509 extensions. /// If , , or are present in the , then the same value should be used. If is not provided, then the accuracy may be available through other means such as i.e. . + /// ASN.1 corrupted data. public Rfc3161TimestampTokenInfo( Oid policyId, Oid hashAlgorithmId, From 088fdc8a9ad64e4a5fd5a183d0afba4dc2ba030a Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Thu, 19 Nov 2020 12:12:38 +0100 Subject: [PATCH 5/8] apply feedback --- .../Pkcs/Rfc3161TimestampTokenInfo.cs | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs index 389e97fba8b77..7eba669a16a1f 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs @@ -33,9 +33,9 @@ public sealed class Rfc3161TimestampTokenInfo /// The timestamp encoded in the token. /// The accuracy with which is compared. Also see . /// to ensure that every timestamp token from the same TSA can always be ordered based on the , regardless of the accuracy; to make indicate when token has been created by the TSA. - /// An arbitrary number that can be used only once. Using a nonce always allows to detect replays, and hence its use is recommended. + /// The nonce associated with this timestamp token. Using a nonce always allows to detect replays, and hence its use is recommended. /// The hint in the TSA name identification. The actual identification of the entity that signed the response will always occur through the use of the certificate identifier. - /// A collection of X509 extensions. + /// The extension values associated with the timestamp. /// If , , or are present in the , then the same value should be used. If is not provided, then the accuracy may be available through other means such as i.e. . /// ASN.1 corrupted data. public Rfc3161TimestampTokenInfo( @@ -76,61 +76,75 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) } /// - /// The version of the timestamp request. + /// Gets the version of the timestamp token. /// + /// The version of the timestamp token. public int Version => _parsedData.Version; /// - /// An OID representing the TSA's policy under which the response was produced. + /// Gets an OID representing the TSA's policy under which the response was produced. /// + /// An OID representing the TSA's policy under which the response was produced. public Oid PolicyId => (_policyOid ??= new Oid(_parsedData.Policy, null)); /// - /// An OID of the hash algorithm. + /// Gets an OID of the hash algorithm. /// + /// An OID of the hash algorithm. public Oid HashAlgorithmId => (_hashAlgorithmId ??= new Oid(_parsedData.MessageImprint.HashAlgorithm.Algorithm, null)); /// - /// The data representing the message hash. + /// Gets the data representing the message hash. /// + /// The data representing the message hash. public ReadOnlyMemory GetMessageHash() => _parsedData.MessageImprint.HashedMessage; /// - /// An integer assigned by the TSA to the . + /// Gets an integer assigned by the TSA to the . /// + /// An integer assigned by the TSA to the . public ReadOnlyMemory GetSerialNumber() => _parsedData.SerialNumber; /// - /// The timestamp encoded in the token. + /// Gets the timestamp encoded in the token. /// + /// The timestamp encoded in the token. public DateTimeOffset Timestamp => _parsedData.GenTime; /// - /// The accuracy with which is compared. Also see . + /// Gets the accuracy with which is compared. /// + /// + /// The accuracy with which is compared. public long? AccuracyInMicroseconds => _parsedData.Accuracy?.TotalMicros; /// /// Gets a value indicating if every timestamp token from the same TSA can always be ordered based on the , regardless of the accuracy; If , indicates when the token has been created by the TSA. /// + /// A value indicating if every timestamp token from the same TSA can always be ordered based on the . public bool IsOrdering => _parsedData.Ordering; /// - /// An arbitrary number that can be used only once. + /// Gets the nonce associated with this timestamp token. /// + /// The nonce indicating whether there are any extensions associated with this timestamp token. public ReadOnlyMemory? GetNonce() => _parsedData.Nonce; /// - /// Gets a value indicating whether there are any X509 extensions. + /// Gets a value indicating whether there are any extensions associated with this timestamp token. /// + /// A value indicating whether there are any extensions associated with this timestamp token. public bool HasExtensions => _parsedData.Extensions?.Length > 0; /// /// Gets the data representing the hint in the TSA name identification. + /// + /// Tthe data representing the hint in the TSA name identification. + /// /// The actual identification of the entity that signed the response /// will always occur through the use of the certificate identifier (ESSCertID Attribute) /// inside a SigningCertificate attribute which is part of the signer info. - /// + /// public ReadOnlyMemory? GetTimestampAuthorityName() { if (_tsaNameBytes == null) @@ -152,8 +166,9 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) } /// - /// Returns a collection of X509 certificates. + /// Gets the extension values associated with the timestamp. /// + /// The extension values associated with the timestamp. public X509ExtensionCollection GetExtensions() { var coll = new X509ExtensionCollection(); @@ -182,15 +197,16 @@ public X509ExtensionCollection GetExtensions() } /// - /// Returns a byte array representing ASN.1 encoded data. + /// Encodes this object into a TSTInfo value /// + /// The encoded TSTInfo value. public byte[] Encode() { return _encodedBytes.CloneByteArray(); } /// - /// Gets the ASN.1 encoded data. + /// Attempts to encode this object as a TSTInfo value, writing the result into the provided buffer. /// /// The destination buffer. /// When this method returns , contains the bytes written to the buffer. @@ -209,7 +225,7 @@ public bool TryEncode(Span destination, out int bytesWritten) } /// - /// Decodes the ASN.1 encoded data. + /// Decodes an encoded TSTInfo value. /// /// The input or source buffer. /// When this method returns , the decoded data. When this method returns , the value is , meaning the data could not be decoded. From d03026e54a12a3c2dd853da4863dd7a35afbc993 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Thu, 19 Nov 2020 12:40:46 +0100 Subject: [PATCH 6/8] fix merge conflict (renamed parameters) --- .../Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs index 7eba669a16a1f..6a61c2e72805a 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs @@ -34,7 +34,7 @@ public sealed class Rfc3161TimestampTokenInfo /// The accuracy with which is compared. Also see . /// to ensure that every timestamp token from the same TSA can always be ordered based on the , regardless of the accuracy; to make indicate when token has been created by the TSA. /// The nonce associated with this timestamp token. Using a nonce always allows to detect replays, and hence its use is recommended. - /// The hint in the TSA name identification. The actual identification of the entity that signed the response will always occur through the use of the certificate identifier. + /// The hint in the TSA name identification. The actual identification of the entity that signed the response will always occur through the use of the certificate identifier. /// The extension values associated with the timestamp. /// If , , or are present in the , then the same value should be used. If is not provided, then the accuracy may be available through other means such as i.e. . /// ASN.1 corrupted data. @@ -47,7 +47,7 @@ public Rfc3161TimestampTokenInfo( long? accuracyInMicroseconds = null, bool isOrdering = false, ReadOnlyMemory? nonce = null, - ReadOnlyMemory? tsaName = null, + ReadOnlyMemory? timestampAuthorityName = null, X509ExtensionCollection? extensions = null) { _encodedBytes = Encode( @@ -59,7 +59,7 @@ public Rfc3161TimestampTokenInfo( isOrdering, accuracyInMicroseconds, nonce, - tsaName, + timestampAuthorityName, extensions); if (!TryDecode(_encodedBytes, true, out _parsedData, out _, out _)) @@ -227,16 +227,16 @@ public bool TryEncode(Span destination, out int bytesWritten) /// /// Decodes an encoded TSTInfo value. /// - /// The input or source buffer. + /// The input or source buffer. /// When this method returns , the decoded data. When this method returns , the value is , meaning the data could not be decoded. /// The number of bytes used for decoding. /// if the operation succeeded; otherwise. public static bool TryDecode( - ReadOnlyMemory source, + ReadOnlyMemory encodedBytes, [NotNullWhen(true)] out Rfc3161TimestampTokenInfo? timestampTokenInfo, out int bytesConsumed) { - if (TryDecode(source, false, out Rfc3161TstInfo tstInfo, out bytesConsumed, out byte[]? copiedBytes)) + if (TryDecode(encodedBytes, false, out Rfc3161TstInfo tstInfo, out bytesConsumed, out byte[]? copiedBytes)) { timestampTokenInfo = new Rfc3161TimestampTokenInfo(copiedBytes!, tstInfo); return true; From e704d10a662bc4f03e92c8367276b9403f65019b Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Thu, 19 Nov 2020 18:14:18 +0100 Subject: [PATCH 7/8] Apply suggestions from code review Co-authored-by: Jeremy Barton --- .../Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs index 6a61c2e72805a..f8e6a709d5ec5 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs @@ -127,7 +127,7 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) /// /// Gets the nonce associated with this timestamp token. /// - /// The nonce indicating whether there are any extensions associated with this timestamp token. + /// The nonce associated with this timestamp token. public ReadOnlyMemory? GetNonce() => _parsedData.Nonce; /// @@ -139,7 +139,7 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) /// /// Gets the data representing the hint in the TSA name identification. /// - /// Tthe data representing the hint in the TSA name identification. + /// The data representing the hint in the TSA name identification. /// /// The actual identification of the entity that signed the response /// will always occur through the use of the certificate identifier (ESSCertID Attribute) From fc0e797dfd7c7a1dc06f05ad925fe5cfd24797ef Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Fri, 20 Nov 2020 17:39:12 +0100 Subject: [PATCH 8/8] Update src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs --- .../Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs index f8e6a709d5ec5..bd514ccb91f84 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Rfc3161TimestampTokenInfo.cs @@ -127,7 +127,7 @@ private Rfc3161TimestampTokenInfo(byte[] copiedBytes, Rfc3161TstInfo tstInfo) /// /// Gets the nonce associated with this timestamp token. /// - /// The nonce associated with this timestamp token. + /// The nonce associated with this timestamp token. public ReadOnlyMemory? GetNonce() => _parsedData.Nonce; ///