├── .gitignore ├── BuildProcessTemplates ├── DefaultTemplate.11.1.xaml ├── LabDefaultTemplate.11.xaml └── UpgradeTemplate.xaml ├── GoogleAuthenticator ├── GoogleAuthenticator.sln ├── GoogleAuthenticator.vssscc └── GoogleAuthenticator │ ├── App.xaml │ ├── App.xaml.cs │ ├── Base32.cs │ ├── BytesToStringConverter.cs │ ├── GoogleAuthenticator.csproj │ ├── GoogleAuthenticator.csproj.vspscc │ ├── GoogleAuthenticator_TemporaryKey.pfx │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── README.md └── license.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /BuildProcessTemplates/DefaultTemplate.11.1.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | [New Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings()] 27 | [False] 28 | [New Microsoft.TeamFoundation.Build.Workflow.Activities.TestSpecList(New Microsoft.TeamFoundation.Build.Workflow.Activities.AgileTestPlatformSpec("**\*test*.dll"))] 29 | ["$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)"] 30 | [False] 31 | [True] 32 | [True] 33 | [Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.All] 34 | 35 | 36 | 37 | [Microsoft.TeamFoundation.Build.Workflow.Activities.CodeAnalysisOption.AsConfigured] 38 | [True] 39 | [Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto] 40 | [True] 41 | [New Microsoft.TeamFoundation.Build.Workflow.Activities.SourceAndSymbolServerSettings(True, Nothing)] 42 | [True] 43 | 44 | 45 | 46 | [New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly }] 47 | [Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal] 48 | 49 | 50 | 51 | 52 | 53 | 54 | All 55 | 11.0 56 | Assembly references and imported namespaces serialized as XML namespaces 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | -------------------------------------------------------------------------------- /BuildProcessTemplates/LabDefaultTemplate.11.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 11.0 16 | 17 | 18 | 19 | 20 | 21 | 920,3702 22 | Assembly references and imported namespaces serialized as XML namespaces 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | True 44 | 45 | 46 | 47 | 48 | 49 | 50 | [LabWorkflowParameters.BuildDetails.BuildUri] 51 | 52 | 53 | [ChildBuildDetail.Uri] 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | [BuildLocation] 66 | 67 | 68 | [If(LabWorkflowParameters.BuildDetails.Configuration Is Nothing, BuildLocation, If(LabWorkflowParameters.BuildDetails.Configuration.IsEmpty Or (SelectedBuildDetail.Information.GetNodesByType(Microsoft.TeamFoundation.Build.Common.InformationTypes.ConfigurationSummary, True)).Count = 1, BuildLocation, If(LabWorkflowParameters.BuildDetails.Configuration.IsPlatformEmptyOrAnyCpu, BuildLocation + "\" + LabWorkflowParameters.BuildDetails.Configuration.Configuration, BuildLocation + "\" + LabWorkflowParameters.BuildDetails.Configuration.Platform + "\" + LabWorkflowParameters.BuildDetails.Configuration.Configuration)))] 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | [LabEnvironmentUri] 81 | 82 | 83 | [LabWorkflowParameters.EnvironmentDetails.LabEnvironmentUri.ToString()] 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | [PostDeploymentSnapshotName] 143 | 144 | 145 | [If(LabWorkflowParameters.BuildDetails.IsTeamSystemBuild = True,String.Format("{0}_{1}_{2}", LabWorkflowParameters.DeploymentDetails.PostDeploymentSnapshotName, BuildNumber,BuildDetail.BuildNumber),String.Format("{0}_{1}", LabWorkflowParameters.DeploymentDetails.PostDeploymentSnapshotName, BuildDetail.BuildNumber))] 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | [BuildStatus] 184 | 185 | 186 | [Microsoft.TeamFoundation.Build.Client.BuildStatus.PartiallySucceeded] 187 | 188 | 189 | 190 | 191 | 192 | 193 | [BuildStatus] 194 | 195 | 196 | [Microsoft.TeamFoundation.Build.Client.BuildStatus.Failed] 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /BuildProcessTemplates/UpgradeTemplate.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | [New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly }] 21 | 22 | 23 | 24 | [Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto] 25 | [False] 26 | [False] 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | [Microsoft.TeamFoundation.VersionControl.Client.RecursionType.OneLevel] 37 | [Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal] 38 | 39 | 40 | 41 | All 42 | Assembly references and imported namespaces serialized as XML namespaces 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoogleAuthenticator", "GoogleAuthenticator\GoogleAuthenticator.csproj", "{7D061541-D8DC-4224-9455-3033A476055E}" 5 | EndProject 6 | Global 7 | GlobalSection(TeamFoundationVersionControl) = preSolution 8 | SccNumberOfProjects = 2 9 | SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} 10 | SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs36 11 | SccLocalPath0 = . 12 | SccProjectUniqueName1 = GoogleAuthenticator\\GoogleAuthenticator.csproj 13 | SccProjectName1 = GoogleAuthenticator 14 | SccLocalPath1 = GoogleAuthenticator 15 | EndGlobalSection 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|x86 = Debug|x86 18 | Release|x86 = Release|x86 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {7D061541-D8DC-4224-9455-3033A476055E}.Debug|x86.ActiveCfg = Debug|x86 22 | {7D061541-D8DC-4224-9455-3033A476055E}.Debug|x86.Build.0 = Debug|x86 23 | {7D061541-D8DC-4224-9455-3033A476055E}.Release|x86.ActiveCfg = Release|x86 24 | {7D061541-D8DC-4224-9455-3033A476055E}.Release|x86.Build.0 = Release|x86 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator.vssscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" 10 | } 11 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/App.xaml.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Lars Truijens, Sourodeep Chatterjee 4 | // 5 | // 6 | // Interaction logic for App.xaml 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace GoogleAuthenticator 11 | { 12 | using System.Windows; 13 | 14 | /// 15 | /// Interaction logic for App.XAML 16 | /// 17 | public partial class App : Application 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/Base32.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Lars Truijens, Sourodeep Chatterjee 4 | // 5 | // 6 | // The base 32. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace GoogleAuthenticator 11 | { 12 | using System; 13 | 14 | using GoogleAuthenticator.Properties; 15 | 16 | // http://stackoverflow.com/a/7135008/1242 17 | 18 | /// 19 | /// The base 32. 20 | /// 21 | public static class Base32 22 | { 23 | /// 24 | /// The to bytes. 25 | /// 26 | /// 27 | /// The input. 28 | /// 29 | /// 30 | /// The . 31 | /// 32 | /// 33 | /// throws if Argument Null Exception 34 | /// 35 | public static byte[] ToBytes(string input) 36 | { 37 | if (string.IsNullOrEmpty(input)) 38 | { 39 | throw new ArgumentNullException(nameof(input)); 40 | } 41 | 42 | input = input.TrimEnd('='); // remove padding characters 43 | var byteCount = input.Length * 5 / 8; // this must be TRUNCATED 44 | var returnArray = new byte[byteCount]; 45 | 46 | byte curByte = 0, bitsRemaining = 8; 47 | var arrayIndex = 0; 48 | 49 | foreach (var c in input) 50 | { 51 | var cValue = CharToValue(c); 52 | 53 | var mask = 0; 54 | if (bitsRemaining > 5) 55 | { 56 | mask = cValue << (bitsRemaining - 5); 57 | curByte = (byte)(curByte | mask); 58 | bitsRemaining -= 5; 59 | } 60 | else 61 | { 62 | mask = cValue >> (5 - bitsRemaining); 63 | curByte = (byte)(curByte | mask); 64 | returnArray[arrayIndex++] = curByte; 65 | curByte = (byte)(cValue << (3 + bitsRemaining)); 66 | bitsRemaining += 3; 67 | } 68 | } 69 | 70 | // if we didn't end with a full byte 71 | if (arrayIndex != byteCount) 72 | { 73 | returnArray[arrayIndex] = curByte; 74 | } 75 | 76 | return returnArray; 77 | } 78 | 79 | /// 80 | /// The to string. 81 | /// 82 | /// 83 | /// The input. 84 | /// 85 | /// 86 | /// The . 87 | /// 88 | /// 89 | /// throws if Argument Null Exception 90 | /// 91 | public static string ToString(byte[] input) 92 | { 93 | if (input == null || input.Length == 0) 94 | { 95 | throw new ArgumentNullException(nameof(input)); 96 | } 97 | 98 | var charCount = (int)Math.Ceiling(input.Length / 5d) * 8; 99 | var returnArray = new char[charCount]; 100 | 101 | byte nextChar = 0, bitsRemaining = 5; 102 | var arrayIndex = 0; 103 | 104 | foreach (var b in input) 105 | { 106 | nextChar = (byte)(nextChar | (b >> (8 - bitsRemaining))); 107 | returnArray[arrayIndex++] = ValueToChar(nextChar); 108 | 109 | if (bitsRemaining < 4) 110 | { 111 | nextChar = (byte)((b >> (3 - bitsRemaining)) & 31); 112 | returnArray[arrayIndex++] = ValueToChar(nextChar); 113 | bitsRemaining += 5; 114 | } 115 | 116 | bitsRemaining -= 3; 117 | nextChar = (byte)((b << bitsRemaining) & 31); 118 | } 119 | 120 | // if we didn't end with a full char 121 | if (arrayIndex != charCount) 122 | { 123 | returnArray[arrayIndex++] = ValueToChar(nextChar); 124 | while (arrayIndex != charCount) 125 | { 126 | returnArray[arrayIndex++] = '='; // padding 127 | } 128 | } 129 | 130 | return new string(returnArray); 131 | } 132 | 133 | /// 134 | /// The char to value. 135 | /// 136 | /// 137 | /// The c. 138 | /// 139 | /// 140 | /// The . 141 | /// 142 | /// 143 | /// throws if Argument Null Exception 144 | /// 145 | private static int CharToValue(char c) 146 | { 147 | var value = (int)c; 148 | 149 | // 65-90 == uppercase letters 150 | if (value < 91 && value > 64) 151 | { 152 | return value - 65; 153 | } 154 | 155 | // 50-55 == numbers 2-7 156 | if (value < 56 && value > 49) 157 | { 158 | return value - 24; 159 | } 160 | 161 | // 97-122 == lowercase letters 162 | if (value < 123 && value > 96) 163 | { 164 | return value - 97; 165 | } 166 | 167 | throw new ArgumentException(Resources.Base32_CharToValue_Character_is_not_a_Base32_character_, nameof(c)); 168 | } 169 | 170 | /// 171 | /// The value to char. 172 | /// 173 | /// 174 | /// The b. 175 | /// 176 | /// 177 | /// The . 178 | /// 179 | /// 180 | /// throws if Argument Null Exception 181 | /// 182 | private static char ValueToChar(byte b) 183 | { 184 | if (b < 26) 185 | { 186 | return (char)(b + 65); 187 | } 188 | 189 | if (b < 32) 190 | { 191 | return (char)(b + 24); 192 | } 193 | 194 | throw new ArgumentException(Resources.Base32_ValueToChar_Byte_is_not_a_value_Base32_value_, nameof(b)); 195 | } 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/BytesToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Lars Truijens, Sourodeep Chatterjee 4 | // 5 | // 6 | // Defines the BytesToStringConverter type. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace GoogleAuthenticator 11 | { 12 | using System; 13 | using System.Globalization; 14 | using System.Runtime.Remoting; 15 | using System.Runtime.Remoting.Metadata.W3cXsd2001; 16 | using System.Windows.Data; 17 | using System.Windows.Markup; 18 | 19 | /// 20 | /// The bytes to string converter. 21 | /// 22 | [ValueConversion(typeof(byte[]), typeof(string))] 23 | public class BytesToStringConverter : MarkupExtension, IValueConverter 24 | { 25 | /// 26 | /// The convert. 27 | /// 28 | /// 29 | /// The value. 30 | /// 31 | /// 32 | /// The target type. 33 | /// 34 | /// 35 | /// The parameter. 36 | /// 37 | /// 38 | /// The culture. 39 | /// 40 | /// 41 | /// The . 42 | /// 43 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => 44 | this.BytesToString((byte[])value); 45 | 46 | /// 47 | /// The convert back. 48 | /// 49 | /// 50 | /// The value. 51 | /// 52 | /// 53 | /// The target type. 54 | /// 55 | /// 56 | /// The parameter. 57 | /// 58 | /// 59 | /// The culture. 60 | /// 61 | /// 62 | /// The . 63 | /// 64 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 65 | { 66 | if (value != null && ((string)value).Length % 2 == 0) 67 | { 68 | return this.StringToBytes((string)value); 69 | } 70 | 71 | return Binding.DoNothing; 72 | } 73 | 74 | /// 75 | /// The provide value. 76 | /// 77 | /// 78 | /// The service provider. 79 | /// 80 | /// 81 | /// The . 82 | /// 83 | public override object ProvideValue(IServiceProvider serviceProvider) => this; 84 | 85 | // http://stackoverflow.com/a/2556329/1242 86 | 87 | /// 88 | /// The string to bytes. 89 | /// 90 | /// 91 | /// The value. 92 | /// 93 | /// 94 | /// The . 95 | /// 96 | public byte[] StringToBytes(string value) 97 | { 98 | try 99 | { 100 | var shb = SoapHexBinary.Parse(value); 101 | return shb.Value; 102 | } 103 | catch (RemotingException) 104 | { 105 | return new byte[0]; 106 | } 107 | } 108 | 109 | /// 110 | /// The bytes to string. 111 | /// 112 | /// 113 | /// The value. 114 | /// 115 | /// 116 | /// The . 117 | /// 118 | public string BytesToString(byte[] value) 119 | { 120 | var shb = new SoapHexBinary(value); 121 | return shb.ToString(); 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/GoogleAuthenticator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {7D061541-D8DC-4224-9455-3033A476055E} 9 | WinExe 10 | Properties 11 | GoogleAuthenticator 12 | GoogleAuthenticator 13 | v4.0 14 | Client 15 | 512 16 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 4 18 | SAK 19 | SAK 20 | SAK 21 | SAK 22 | true 23 | publish\ 24 | true 25 | Web 26 | true 27 | Foreground 28 | 7 29 | Days 30 | false 31 | false 32 | true 33 | http://googleauthcsharp.codeplex.com/releases/clickonce/ 34 | true 35 | publish.htm 36 | 3 37 | 1.0.0.%2a 38 | false 39 | true 40 | true 41 | 42 | 43 | x86 44 | true 45 | full 46 | false 47 | bin\Debug\ 48 | DEBUG;TRACE 49 | prompt 50 | 4 51 | 52 | 53 | x86 54 | pdbonly 55 | true 56 | bin\Release\ 57 | TRACE 58 | prompt 59 | 4 60 | 61 | 62 | 3C9B343E222ACB339E9DE551D95948978BAD56D7 63 | 64 | 65 | GoogleAuthenticator_TemporaryKey.pfx 66 | 67 | 68 | true 69 | 70 | 71 | true 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 4.0 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | MSBuild:Compile 91 | Designer 92 | 93 | 94 | MSBuild:Compile 95 | Designer 96 | 97 | 98 | App.xaml 99 | Code 100 | 101 | 102 | 103 | 104 | MainWindow.xaml 105 | Code 106 | 107 | 108 | 109 | 110 | Code 111 | 112 | 113 | True 114 | True 115 | Resources.resx 116 | 117 | 118 | True 119 | Settings.settings 120 | True 121 | 122 | 123 | ResXFileCodeGenerator 124 | Resources.Designer.cs 125 | 126 | 127 | 128 | SettingsSingleFileGenerator 129 | Settings.Designer.cs 130 | 131 | 132 | 133 | 134 | 135 | False 136 | Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 137 | true 138 | 139 | 140 | False 141 | .NET Framework 3.5 SP1 Client Profile 142 | false 143 | 144 | 145 | False 146 | .NET Framework 3.5 SP1 147 | false 148 | 149 | 150 | False 151 | Windows Installer 3.1 152 | true 153 | 154 | 155 | 156 | 163 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/GoogleAuthenticator.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/GoogleAuthenticator_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LTruijens/google-auth-csharp/307718f66bb35f62af2fad2c506dbf6a7c667669/GoogleAuthenticator/GoogleAuthenticator/GoogleAuthenticator_TemporaryKey.pfx -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Identity 23 | 24 | 25 | Secret Base32 26 | 27 | 28 | Secret Hex 29 | 30 | 31 | QR code 32 | 33 | 34 | Timestamp 35 | 36 | 37 | Hmac 38 | 39 | 40 | 41 | 42 | 43 | 44 | One-time password 45 | 46 | 47 | Seconds to go 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Lars Truijens, Sourodeep Chatterjee 4 | // 5 | // 6 | // Interaction logic for MainWindow.xaml 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | 11 | 12 | namespace GoogleAuthenticator 13 | { 14 | using System; 15 | using System.ComponentModel; 16 | using System.Linq; 17 | using System.Security.Cryptography; 18 | using System.Windows; 19 | using System.Windows.Threading; 20 | 21 | /// 22 | /// Interaction logic for MainWindow.XAML 23 | /// 24 | /// Converted from http://jsfiddle.net/russau/uRCTk/ 25 | /// Implementation of https://tools.ietf.org/html/rfc6238 26 | public partial class MainWindow : Window, INotifyPropertyChanged 27 | { 28 | /// 29 | /// The seconds to go. 30 | /// 31 | private int secondsToGo; 32 | 33 | /// 34 | /// The identity. 35 | /// 36 | private string identity; 37 | 38 | /// 39 | /// The secret. 40 | /// 41 | private byte[] secret; 42 | 43 | /// 44 | /// The timestamp. 45 | /// 46 | private long timestamp; 47 | 48 | /// 49 | /// The h-mac. 50 | /// 51 | private byte[] hmac; 52 | 53 | /// 54 | /// The offset. 55 | /// 56 | private int offset; 57 | 58 | /// 59 | /// The one time password. 60 | /// 61 | private int oneTimePassword; 62 | 63 | /// 64 | /// Initializes a new instance of the class. 65 | /// 66 | public MainWindow() 67 | { 68 | this.InitializeComponent(); 69 | 70 | var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) }; 71 | timer.Tick += (s, e) => this.SecondsToGo = 30 - Convert.ToInt32(GetUnixTimestamp() % 30); 72 | timer.IsEnabled = true; 73 | 74 | this.Secret = new byte[] { 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x21, 0xDE, 0xAD, 0xBE, 0xEF }; 75 | this.Identity = "user@host.com"; 76 | 77 | this.DataContext = this; 78 | } 79 | 80 | /// 81 | /// The property changed. 82 | /// 83 | public event PropertyChangedEventHandler PropertyChanged; 84 | 85 | /// 86 | /// Gets the seconds to go. 87 | /// 88 | public int SecondsToGo 89 | { 90 | get => this.secondsToGo; 91 | private set 92 | { 93 | this.secondsToGo = value; 94 | this.OnPropertyChanged("SecondsToGo"); 95 | if (this.SecondsToGo == 30) 96 | { 97 | this.CalculateOneTimePassword(); 98 | } 99 | } 100 | } 101 | 102 | /// 103 | /// Gets or sets the identity. 104 | /// 105 | public string Identity 106 | { 107 | get => this.identity; 108 | set 109 | { 110 | this.identity = value; 111 | this.OnPropertyChanged("Identity"); 112 | this.OnPropertyChanged("QRCodeUrl"); 113 | this.CalculateOneTimePassword(); 114 | } 115 | } 116 | 117 | /// 118 | /// Gets or sets the secret base 32. 119 | /// 120 | public string SecretBase32 121 | { 122 | get => Base32.ToString(this.Secret); 123 | set 124 | { 125 | try 126 | { 127 | this.Secret = Base32.ToBytes(value); 128 | } 129 | catch 130 | { 131 | // ignored 132 | } 133 | 134 | this.OnPropertyChanged("SecretBase32"); 135 | } 136 | } 137 | 138 | /// 139 | /// Gets or sets the secret. 140 | /// 141 | public byte[] Secret 142 | { 143 | get => this.secret; 144 | set 145 | { 146 | this.secret = value; 147 | this.OnPropertyChanged("Secret"); 148 | this.OnPropertyChanged("QRCodeUrl"); 149 | this.CalculateOneTimePassword(); 150 | this.OnPropertyChanged("SecretBase32"); 151 | } 152 | } 153 | 154 | /// 155 | /// The QR code url. 156 | /// 157 | public string QrCodeUrl => this.GetQrCodeUrl(); 158 | 159 | /// 160 | /// Gets the timestamp. 161 | /// 162 | public long Timestamp 163 | { 164 | get => this.timestamp; 165 | private set 166 | { 167 | this.timestamp = value; 168 | this.OnPropertyChanged("Timestamp"); 169 | } 170 | } 171 | 172 | /// 173 | /// Gets the h-mac. 174 | /// 175 | public byte[] Hmac 176 | { 177 | get => this.hmac; 178 | private set 179 | { 180 | this.hmac = value; 181 | this.OnPropertyChanged("Hmac"); 182 | this.OnPropertyChanged("HmacPart1"); 183 | this.OnPropertyChanged("HmacPart2"); 184 | this.OnPropertyChanged("HmacPart3"); 185 | } 186 | } 187 | 188 | /// 189 | /// Gets the h-mac part 1. 190 | /// 191 | public byte[] HmacPart1 => this.hmac.Take(this.Offset).ToArray(); 192 | 193 | /// 194 | /// Gets the h-mac part 2. 195 | /// 196 | public byte[] HmacPart2 => this.hmac.Skip(this.Offset).Take(4).ToArray(); 197 | 198 | /// 199 | /// Gets the h-mac part 3. 200 | /// 201 | public byte[] HmacPart3 => this.hmac.Skip(this.Offset + 4).ToArray(); 202 | 203 | /// 204 | /// Gets the offset. 205 | /// 206 | public int Offset 207 | { 208 | get => this.offset; 209 | private set 210 | { 211 | this.offset = value; 212 | this.OnPropertyChanged("Offset"); 213 | } 214 | } 215 | 216 | /// 217 | /// Gets or sets the one time password. 218 | /// 219 | public int OneTimePassword 220 | { 221 | get => this.oneTimePassword; 222 | set 223 | { 224 | this.oneTimePassword = value; 225 | this.OnPropertyChanged("OneTimePassword"); 226 | } 227 | } 228 | 229 | /// 230 | /// The get UNIX timestamp. 231 | /// 232 | /// 233 | /// The . 234 | /// 235 | private static long GetUnixTimestamp() => 236 | Convert.ToInt64(Math.Round((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds)); 237 | 238 | /// 239 | /// The get QR code url. 240 | /// 241 | /// 242 | /// The . 243 | /// 244 | private string GetQrCodeUrl() 245 | { 246 | // https://code.google.com/p/google-authenticator/wiki/KeyUriFormat 247 | return 248 | $"https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/{this.Identity}%3Fsecret%3D{this.SecretBase32}"; 249 | } 250 | 251 | /// 252 | /// The calculate one time password. 253 | /// 254 | private void CalculateOneTimePassword() 255 | { 256 | // https://tools.ietf.org/html/rfc4226 257 | this.Timestamp = Convert.ToInt64(GetUnixTimestamp() / 30); 258 | var data = BitConverter.GetBytes(this.Timestamp).Reverse().ToArray(); 259 | this.Hmac = new HMACSHA1(this.Secret).ComputeHash(data); 260 | this.Offset = this.Hmac.Last() & 0x0F; 261 | this.OneTimePassword = ( 262 | ((this.Hmac[this.Offset + 0] & 0x7f) << 24) | 263 | ((this.Hmac[this.Offset + 1] & 0xff) << 16) | 264 | ((this.Hmac[this.Offset + 2] & 0xff) << 8) | 265 | (this.Hmac[this.Offset + 3] & 0xff)) % 1000000; 266 | } 267 | 268 | /// 269 | /// The on property changed. 270 | /// 271 | /// 272 | /// The property name. 273 | /// 274 | private void OnPropertyChanged(string propertyName) => 275 | this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 276 | } 277 | } 278 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Lars Truijens, Sourodeep Chatterjee 4 | // 5 | // 6 | // AssemblyInfo.cs 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | using System.Windows; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle("GoogleAuthenticator")] 18 | [assembly: AssemblyDescription("")] 19 | [assembly: AssemblyConfiguration("")] 20 | [assembly: AssemblyCompany("")] 21 | [assembly: AssemblyProduct("GoogleAuthenticator")] 22 | [assembly: AssemblyCopyright("Copyright © 2011")] 23 | [assembly: AssemblyTrademark("")] 24 | [assembly: AssemblyCulture("")] 25 | 26 | // Setting ComVisible to false makes the types in this assembly not visible 27 | // to COM components. If you need to access a type in this assembly from 28 | // COM, set the ComVisible attribute to true on that type. 29 | [assembly: ComVisible(false)] 30 | 31 | /*In order to begin building localizable applications, set 32 | * CultureYouAreCodingWith in your .csproj file 33 | * inside a . For example, if you are using US english 34 | * in your source files, set the to en-US. Then uncomment 35 | * the NeutralResourceLanguage attribute below. Update the "en-US" in 36 | * the line below to match the UICulture setting in the project file. 37 | 38 | * [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 39 | */ 40 | 41 | 42 | [assembly: ThemeInfo( 43 | ResourceDictionaryLocation.None, // where theme specific resource dictionaries are located 44 | // (used if a resource is not found in the page, 45 | // or application resource dictionaries) 46 | ResourceDictionaryLocation.SourceAssembly // where the generic resource dictionary is located 47 | // (used if a resource is not found in the page, 48 | // app, or any theme specific resource dictionaries) 49 | )] 50 | 51 | 52 | // Version information for an assembly consists of the following four values: 53 | // 54 | // Major Version 55 | // Minor Version 56 | // Build Number 57 | // Revision 58 | // 59 | // You can specify all the values or you can default the Build and Revision Numbers 60 | // by using the '*' as shown below: 61 | // [assembly: AssemblyVersion("1.0.*")] 62 | [assembly: AssemblyVersion("1.0.0.0")] 63 | [assembly: AssemblyFileVersion("1.0.0.0")] 64 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GoogleAuthenticator.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GoogleAuthenticator.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Character is not a Base32 character.. 65 | /// 66 | internal static string Base32_CharToValue_Character_is_not_a_Base32_character_ { 67 | get { 68 | return ResourceManager.GetString("Base32_CharToValue_Character_is_not_a_Base32_character_", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to Byte is not a value Base32 value.. 74 | /// 75 | internal static string Base32_ValueToChar_Byte_is_not_a_value_Base32_value_ { 76 | get { 77 | return ResourceManager.GetString("Base32_ValueToChar_Byte_is_not_a_value_Base32_value_", resourceCulture); 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | Character is not a Base32 character. 119 | 120 | 121 | Byte is not a value Base32 value. 122 | 123 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GoogleAuthenticator.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /GoogleAuthenticator/GoogleAuthenticator/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # google-auth-csharp 2 | Google Authenticator TOTP C# 3 | 4 | An implementation of Google's Authenticator in C# and WPF. It's a Time-based One-time Password (TOTP) described in RFC 6238. You could use it to implement two-factor authentication in your own .Net application. 5 | 6 | * Based on http://code.google.com/p/google-authenticator/ 7 | * Converted from http://jsfiddle.net/russau/uRCTk/ 8 | 9 | A big thanks to NDepend for sponsoring this project. 10 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | BSD 2 | Copyright (c) 2011, Lars Truijens 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | 9 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | 11 | * Neither the name of Lars Truijens nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------