File tree Expand file tree Collapse file tree
DotNetOpenAuth.Core/Messaging
DotNetOpenAuth.OAuth2.Client/OAuth2
DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -696,11 +696,14 @@ internal static string GetCryptoRandomDataAsBase64(int binaryLength) {
696696 /// Gets a NON-cryptographically strong random string of base64 characters.
697697 /// </summary>
698698 /// <param name="binaryLength">The length of the byte sequence to generate.</param>
699- /// <returns>A base64 encoding of the generated random data,
700- /// whose length in characters will likely be greater than <paramref name="binaryLength"/>.</returns>
701- internal static string GetNonCryptoRandomDataAsBase64 ( int binaryLength ) {
699+ /// <param name="useWeb64">A value indicating whether web64 encoding is used to avoid the need to escape characters.</param>
700+ /// <returns>
701+ /// A base64 encoding of the generated random data,
702+ /// whose length in characters will likely be greater than <paramref name="binaryLength" />.
703+ /// </returns>
704+ internal static string GetNonCryptoRandomDataAsBase64 ( int binaryLength , bool useWeb64 = false ) {
702705 byte [ ] uniq_bytes = GetNonCryptoRandomData ( binaryLength ) ;
703- string uniq = Convert . ToBase64String ( uniq_bytes ) ;
706+ string uniq = useWeb64 ? ConvertToBase64WebSafeString ( uniq_bytes ) : Convert . ToBase64String ( uniq_bytes ) ;
704707 return uniq ;
705708 }
706709
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ public OutgoingWebResponse PrepareRequestUserAuthorization(IAuthorizationState a
113113 if ( this . AuthorizationTracker == null ) {
114114 var context = this . Channel . GetHttpContext ( ) ;
115115
116- string xsrfKey = MessagingUtilities . GetNonCryptoRandomDataAsBase64 ( 16 ) ;
116+ string xsrfKey = MessagingUtilities . GetNonCryptoRandomDataAsBase64 ( 16 , useWeb64 : true ) ;
117117 cookie = new HttpCookie ( XsrfCookieName , xsrfKey ) {
118118 HttpOnly = true ,
119119 Secure = FormsAuthentication . RequireSSL ,
Original file line number Diff line number Diff line change @@ -209,7 +209,7 @@ public CultureInfo Culture {
209209 // of language and country based on user settings.
210210 try {
211211 this . culture = CultureInfo . GetCultureInfo ( cultureString ) ;
212- } catch ( CultureNotFoundException ) {
212+ } catch ( ArgumentException ) { // CultureNotFoundException derives from this, and .NET 3.5 throws the base type
213213 // Fallback to just reporting a culture based on language.
214214 this . culture = CultureInfo . GetCultureInfo ( this . Language ) ;
215215 }
You can’t perform that action at this time.
0 commit comments