diff --git a/Src/Support/Google.Apis.Auth/OAuth2/ComputeCredential.cs b/Src/Support/Google.Apis.Auth/OAuth2/ComputeCredential.cs index 0dc7821b7f5..88a21b6b708 100644 --- a/Src/Support/Google.Apis.Auth/OAuth2/ComputeCredential.cs +++ b/Src/Support/Google.Apis.Auth/OAuth2/ComputeCredential.cs @@ -380,7 +380,7 @@ private static async Task IsGoogleBiosAsync() bool IsWindows() { #if NET462 - // RuntimeInformation.IsOsPlatform is not available for NET45. + // RuntimeInformation.IsOsPlatform is not available for .NET 4.6.2. // We are probably on Windows, unless we are using Mono which means we might be // elsewhere. But we don't have a reliable way to determine that, so let's // return false, always. @@ -394,7 +394,7 @@ bool IsWindows() bool IsLinux() { #if NET462 - // RuntimeInformation.IsOsPlatform is not available for NET45. + // RuntimeInformation.IsOsPlatform is not available for .NET 4.6.2. // There's a chance we are on Linux if we are using Mono. // But we don't have a reliable way to determine that, so let's // return false, always. diff --git a/Src/Support/Google.Apis.Auth/OAuth2/ServiceAccountCredential.cs b/Src/Support/Google.Apis.Auth/OAuth2/ServiceAccountCredential.cs index 667a5d21c2c..4da1d5bf6e4 100644 --- a/Src/Support/Google.Apis.Auth/OAuth2/ServiceAccountCredential.cs +++ b/Src/Support/Google.Apis.Auth/OAuth2/ServiceAccountCredential.cs @@ -27,10 +27,6 @@ limitations under the License. using Google.Apis.Util; using Google.Apis.Http; -// TODO: We could potentially remove this using alias directive; it was primarily -// to support older frameworks. -using RsaKey = System.Security.Cryptography.RSA; - namespace Google.Apis.Auth.OAuth2 { /// @@ -52,7 +48,6 @@ namespace Google.Apis.Auth.OAuth2 /// public class ServiceAccountCredential : ServiceCredential, IOidcTokenProvider, IGoogleCredential, IBlobSigner { - private const string Sha256Oid = "2.16.840.1.101.3.4.2.1"; private const string ScopedTokenCacheKey = "SCOPED_TOKEN"; /// An initializer class for the service account credential. new public class Initializer : ServiceCredential.Initializer @@ -75,7 +70,7 @@ public class ServiceAccountCredential : ServiceCredential, IOidcTokenProvider, I /// Gets or sets the key which is used to sign the request, as specified in /// https://developers.google.com/accounts/docs/OAuth2ServiceAccount#computingsignature. /// - public RsaKey Key { get; set; } + public RSA Key { get; set; } /// /// Gets or sets the service account key ID. @@ -108,7 +103,7 @@ internal Initializer(ServiceAccountCredential other) : base(other) public Initializer FromPrivateKey(string privateKey) { RSAParameters rsaParameters = Pkcs8.DecodeRsaParameters(privateKey); - Key = (RsaKey)RSA.Create(); + Key = RSA.Create(); Key.ImportParameters(rsaParameters); return this; } @@ -142,7 +137,7 @@ public Initializer FromCertificate(X509Certificate2 certificate) /// Gets the key which is used to sign the request, as specified in /// https://developers.google.com/accounts/docs/OAuth2ServiceAccount#computingsignature. /// - public RsaKey Key { get; } + public RSA Key { get; } /// /// Gets the key id of the key which is used to sign the request. diff --git a/Src/Support/Google.Apis.Auth/SignedTokenVerification.cs b/Src/Support/Google.Apis.Auth/SignedTokenVerification.cs index 5063f00acbf..bdac5e5deee 100644 --- a/Src/Support/Google.Apis.Auth/SignedTokenVerification.cs +++ b/Src/Support/Google.Apis.Auth/SignedTokenVerification.cs @@ -31,10 +31,8 @@ namespace Google.Apis.Auth internal static class SignedTokenVerification { #if NET462_OR_GREATER - // See http://oid-info.com/get/2.16.840.1.101.3.4.2.1 - private const string Sha256Oid = "2.16.840.1.101.3.4.2.1"; - // In net45 We don't have the handy ECParameters class so we need to pass the X and Y - // in the expected format. + // In .NET 4.6.2 we don't have the handy ECParameters struct so we need to pass the X and Y + // in the expected format. (It was introduced in .NET 4.7.) // See here for the format of the key: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-bcrypt_ecckey_blob // And here for the correct prefix for ECDsa: https://stackoverflow.com/a/44527439/1122643 private static readonly byte[] s_cngBlobPrefix = { 0x45, 0x43, 0x53, 0x31, 0x20, 0, 0, 0 }; @@ -165,7 +163,7 @@ static ECDsa BuildEcdsa(byte[] x, byte[] y) #elif NET462 static ECDsa BuildEcdsa(byte[] x, byte[] y) { - // In .NET 4.6.2 We don't have the handy ECParameters class (introduced in .NET 4.7) so we need to pass the X and Y + // In .NET 4.6.2 we don't have the handy ECParameters class (introduced in .NET 4.7) so we need to pass the X and Y // in the expected format. // See here for the format of the key: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-bcrypt_ecckey_blob // And here for the correct prefix for ECDsa: https://stackoverflow.com/a/44527439/1122643 diff --git a/Src/Support/Google.Apis/Upload/ResumableUpload.cs b/Src/Support/Google.Apis/Upload/ResumableUpload.cs index e88734e2598..027a44b4d33 100644 --- a/Src/Support/Google.Apis/Upload/ResumableUpload.cs +++ b/Src/Support/Google.Apis/Upload/ResumableUpload.cs @@ -240,7 +240,7 @@ public void AddToRequest(HttpRequestMessage request) #pragma warning restore CS0618 // Type or member is obsolete } - public Task HandleResponseAsync(HandleUnsuccessfulResponseArgs args) + public Task HandleResponseAsync(HandleUnsuccessfulResponseArgs args) { var result = false; var statusCode = (int)args.Response.StatusCode;