-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Port CmsMessage cmdlets and Get-PfxCertificate to powershell core #3224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
56dddcd
3bbfa7b
c49df23
b7715bc
638fc7f
85fdd7b
563983e
844b5e7
a12e394
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -661,6 +661,36 @@ internal static void SetCurrentThreadUiCulture(CultureInfo uiCultureInfo) | |
|
||
#region Misc | ||
|
||
/// <summary> | ||
/// Facade for Convert.ToBase64String(bytes, Base64FormattingOptions.InsertLineBreaks) | ||
/// Inserts line breaks after every 76 characters in the string representation. | ||
/// </summary> | ||
internal static string ToBase64StringWithLineBreaks(byte[] bytes) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haven't we still Workarround: PS C:\Program Files\PowerShell\6.0.0.16> $test="0123456789" *10
PS C:\Program Files\PowerShell\6.0.0.16> $test
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
PS C:\Program Files\PowerShell\6.0.0.16> [convert]::ToBase64String($test.ToCharArray(), 0, 100,1)
MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2
Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OQ==
PS C:\Program Files\PowerShell\6.0.0.16> [convert]::ToBase64String($test.ToCharArray(), 0, 100,0)
MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OQ== There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So they expose the 'Base64FormattingOptions' overload in runtime assembly but not in contract assembly, interesting. Since this overload is not in contract, we cannot use it in C# code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I add workarround later. Cannot we use it too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for clarify! |
||
{ | ||
#if CORECLR | ||
// Inserts line breaks after every 76 characters in the string representation. | ||
string encodedRawString = Convert.ToBase64String(bytes); | ||
if (encodedRawString.Length <= 76) | ||
return encodedRawString; | ||
|
||
StringBuilder builder = new StringBuilder(encodedRawString.Length); | ||
int index = 0, remainingLen = encodedRawString.Length; | ||
while (remainingLen > 76) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this copied from somewhere in CoreCLR or is it new implementation? I'm curious if it needs additional testing or if it is sufficiently exercised by your tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is new implementation based on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @daxian-dbw Perhaps it makes sense to open new Issue to migrate to .Net Core method when it become available? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened #3235 to track this category of issues. |
||
{ | ||
builder.Append(encodedRawString, index, 76); | ||
builder.Append(System.Environment.NewLine); | ||
|
||
index += 76; | ||
remainingLen -= 76; | ||
} | ||
|
||
builder.Append(encodedRawString, index, remainingLen); | ||
return builder.ToString(); | ||
#else | ||
return Convert.ToBase64String(bytes, Base64FormattingOptions.InsertLineBreaks); | ||
#endif | ||
} | ||
|
||
/// <summary> | ||
/// Facade for RemotingServices.IsTransparentProxy(object) | ||
/// </summary> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
SecureString
in corefx but not in alfa.16 😕There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing this. We need to update our code to use the new APIs once we move to a newer version of .NET Core packages. I opened this issue #3228 to track this effort as well as the list of similar code instances. Please feel free to update the list when you spot one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closed.