Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FromBase64Transform-sample uses InputBlockSize instead of hard-coded 4 #1098

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

Merged
merged 4 commits into from
Jul 31, 2019
Merged

FromBase64Transform-sample uses InputBlockSize instead of hard-coded 4 #1098

merged 4 commits into from
Jul 31, 2019

Conversation

gfoidl
Copy link
Member

@gfoidl gfoidl commented Jul 18, 2019

Depends on dotnet/corefx#39599

myTransform.InputBlockSize returned 1, so the sample code used 4 explicitely, as base64 decoding transforms 4 input bytes to 3 output bytes.

dotnet/corefx#39599 fixes this, so the sample code can use the InputBlockSize provided by the transform.

Additional did unify the code comments in the sample.
And removed the redundant Clear, as this is called by Dispose.

@gfoidl gfoidl requested a review from BillWagner as a code owner July 18, 2019 17:27
@gfoidl gfoidl changed the title Crypto base64 fix inputblocksize FromBase64Transform-sample uses InputBlockSize instead of hard-coded 4 Jul 18, 2019
@BillWagner BillWagner added the 🚧 Hold for related PR Indicates a PR can only be merged when other related PRs are merged (see comments for links) label Jul 22, 2019
@rpetrusha rpetrusha added this to the August 2019 milestone Jul 30, 2019
Copy link

@rpetrusha rpetrusha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the example, @gfoidl. There are also Visual Basic and C++ examples (at <https://github.com/dotnet/samples/snippets/visualbasic/VS_Snippets_CLR_System//system.Security.Cryptography.FromBase64Transform Example/vb/class1.vb> and <https://github.com/dotnet/samples/snippets/cpp/VS_Snippets_CLR_System//system.Security.Cryptography.FromBase64Transform Example/vb/class1.cpp>). Could you make the corresponding changes to those files as well?

Also, code running on .NET Framework and earlier versions of .NET Core will now use 1 as the input block size. It would be good to expand the example description (in the FromBase64Transform.xml file in the dotnet/dotnet-api-docs repo) to note that on .NET implementations with a FromBase64Transform.InputBlockSize that is not 4, a constant value of 4 should be substituted for the property value.

@rpetrusha rpetrusha removed the 🚧 Hold for related PR Indicates a PR can only be merged when other related PRs are merged (see comments for links) label Jul 30, 2019
@gfoidl
Copy link
Member Author

gfoidl commented Jul 31, 2019

For api-docs -> dotnet/dotnet-api-docs#2895

@rpetrusha
Copy link

Thank you, @gfoidl, for modifying the Visual Basic and C++ examples as well. I'll merge this PR and review dotnet/dotnet-api-docs#2895 shortly.

@rpetrusha rpetrusha merged commit 33a9867 into dotnet:master Jul 31, 2019
@gfoidl gfoidl deleted the crypto-base64-fix-inputblocksize branch August 6, 2019 17:56
rpetrusha pushed a commit that referenced this pull request Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants