Sign In
Home
Recent
Media
Videos
Podcasts
Screencasts
Shows
Endpoint
ARCast.TV
Continuum
See All Shows...
Forums
Coffeehouse
Tech Off
Feedback
Sandbox
Wiki
Search
About
Subscribe
codeexamples
Cancel
Save
Edit
Return to
HomePage
Code Examples Index
This page is a catalog of security code examples. Each example is a discrete block of code that includes the intentions and insight behind the code. The examples were drawn from a
code example candidate list
Each code example uses the
Code Example Template
Authentication
*
Hash a Password Using a Random Salt
(
C
|
VB.NET
)
Cookies
*
Decrypt validate encrypted signed cookie
(
C
|
VB.NET
*
Encrypting and Signing a cookie for use by an external web application
(
C
|
VB.NET
*
Setting application and ASP.NET 2.0 cookies securely
(
C
|
VB.NET
Cryptography
*
Creating and securely storing a symmetric encryption key and Initialization Vector
(
C
|
VB.NET
*
Decrypt a file via a block cipher using 3DES
(
C
|
VB.NET
*
Decrypt a file via a block cipher using AES
(
C
|
VB.NET
*
Decrypt a string via a block cipher using 3DES
(
C
|
VB.NET
*
Decrypt a string via a block cipher using AES
(
C
|
VB.NET
*
Encrypt a file via a block cipher using 3DES
(
C
|
VB.NET
*
Encrypt a file via a block cipher using AES
(
C
|
VB.NET
*
Export the Public Key from an RSA Key Pair for Distribution
(
C
|
VB.NET
*
Generate a Message Authentication Code
(
C
|
VB.NET
*
Generate an RSA signature of a given message
(
C
|
VB.NET
*
Generate RSA Keys and Store in the Registry Using DPAPI
(
C
|
VB.NET
*
Generating Cryptographically Secure Random Numbers
(
C
|
VB.NET
*
Import an RSA Public Key from a file and Encrypt a Message
(
C
|
VB.NET
*
Retrieve an RSA Key Pair from the Registry and Decrypt a Message
(
C
|
VB.NET
*
Validate an RSA signature of a given message
(
C
|
VB.NET
Data Access
*
Protect Credentials Within a Connection String in Code
(
C
|
VB.NET
*
Using Parameterized Queries for Secure Database Access
(
C
|
VB.NET
*
Using Stored Procedures for Secure Database Access
(
C
|
VB.NET
I/O
*
Creating a temporary file which avoids canonicalization and race conditions
(
C
|
VB.NET
*
Securely Executing a New Process from a .NET Application
(
C
|
VB.NET
Input and Data Validation
*
Encoding Output within a DataTable
(
C
|
VB.NET
*
Scoping Data Retrieval from the Request Object
(
C
|
VB.NET
*
Validate User Input with Regular Expressions
(
C
|
VB.NET
Registry
*
Protect Data in the Registry Using Key Permissions
(
C
|
VB.NET
ViewState
*
Encrypting ViewState
(
C
|
VB.NET
Web Services
*
Perform XML schema validation of Web Service payload
(
C
|
VB.NET
More Information
*
Code Example Template
*
Code example candidate list
Archive
*
Security Code Examples 1
*
Security Code Examples 2
Return to
HomePage
Return to %5bHomePage%5d ---- %21 Code Examples Index This page is a catalog of security code examples. Each example is a discrete block of code that includes the intentions and insight behind the code. The examples were drawn from a %5bcode example candidate list%7cCodeExampleCandidates.%5d Each code example uses the %5bCode Example Template%7cCodeExampleTemplate.%5d %21%21%21 Authentication * %5bHash a Password Using a Random Salt%7cSaltedHashCode%5d *%28%5bC%23%7cSaltedHashCode%5d %7c %5bVB.NET%7cSaltedHashCode2%5d %29* %21%21%21 Cookies * %5bDecrypt validate encrypted signed cookie%7cDecryptCookieCode%5d *%28%5bC%23%7cDecryptCookieCode%5d %7c %5bVB.NET%7cDecryptCookieCode2%29%5d* * %5bEncrypting and Signing a cookie for use by an external web application%7cCreateCookieCode%5d *%28%5bC%23%7cCreateCookieCode%5d %7c%5bVB.NET%7cCreateCookieCode2%29%5d* * %5bSetting application and ASP.NET 2.0 cookies securely%7cCookieModesCode%5d *%28%5bC%23%7cCookieModesCode%5d %7c %5bVB.NET%7cCookieModesCode2%29%5d* %21%21%21 Cryptography * %5bCreating and securely storing a symmetric encryption key and Initialization Vector%7cGenerateCryptoKeyCode%5d *%28%5bC%23%7cGenerateCryptoKeyCode%5d %7c %5bVB.NET%7cGenerateCryptoKeyCode2%29%5d* * %5bDecrypt a file via a block cipher using 3DES%7cDecryptFileTripleDESCode%5d *%28%5bC%23%7cDecryptFileTripleDESCode%5d %7c %5bVB.NET%7cDecryptFileTripleDESCode2%29%5d* * %5bDecrypt a file via a block cipher using AES%7cDecryptFileAESCode%5d *%28%5bC%23%7cDecryptFileAESCode%5d %7c %5bVB.NET%7cDecryptFileAESCode2%29%5d* * %5bDecrypt a string via a block cipher using 3DES%7cDecryptStringTripleDesCode%5d *%28%5bC%23%7cDecryptStringTripleDesCode%5d %7c %5bVB.NET%7cDecryptStringTripleDesCode2%29%5d* * %5bDecrypt a string via a block cipher using AES%7cDecryptStringAESCode%5d *%28%5bC%23%7cDecryptStringAESCode%5d %7c %5bVB.NET%7cDecryptStringAESCode2%29%5d* * %5bEncrypt a file via a block cipher using 3DES%7cEncryptFileTripleDesCode%5d *%28%5bC%23%7cEncryptFileTripleDesCode%5d %7c %5bVB.NET%7cEncryptFileTripleDesCode2%29%5d* * %5bEncrypt a file via a block cipher using AES%7cEncryptFileAESCode%5d *%28%5bC%23%7cEncryptFileAESCode%5d %7c %5bVB.NET%7cEncryptFileAESCode2%29%5d* * %5bExport the Public Key from an RSA Key Pair for Distribution%7cExportRSAKeyCode%5d *%28%5bC%23%7cExportRSAKeyCode%5d %7c %5bVB.NET%7cExportRSAKeyCode2%29%5d* * %5bGenerate a Message Authentication Code %7cGenerateHMacCode%5d *%28%5bC%23%7cGenerateHMacCode%5d %7c %5bVB.NET%7cGenerateHMacCode2%29%5d* * %5bGenerate an RSA signature of a given message%7cGenerateRSASigCode%5d *%28%5bC%23%7cGenerateRSASigCode%5d %7c %5bVB.NET%7cGenerateRSASigCode2%29%5d* * %5bGenerate RSA Keys and Store in the Registry Using DPAPI%7cCreateRSACode%5d *%28%5bC%23%7cCreateRSACode%5d %7c %5bVB.NET%7cCreateRSACode2%29%5d* * %5bGenerating Cryptographically Secure Random Numbers%7cSecureRNGCode%5d *%28%5bC%23%7cSecureRNGCode%5d %7c %5bVB.NET%7cSecureRNGCode2%29%5d* * %5bImport an RSA Public Key from a file and Encrypt a Message%7cImportRSACode%5d *%28%5bC%23%7cImportRSACode%5d %7c %5bVB.NET%7cImportRSACode2%29%5d* * %5bRetrieve an RSA Key Pair from the Registry and Decrypt a Message%7cRetrieveRSAKeyCode%5d *%28%5bC%23%7cRetrieveRSAKeyCode%5d %7c %5bVB.NET%7cRetrieveRSAKeyCode2%29%5d* * %5bValidate an RSA signature of a given message%7cValidateRSASigCode%5d *%28%5bC%23%7cValidateRSASigCode%5d %7c %5bVB.NET%7cValidateRSASigCode2%29%5d* %21%21%21 Data Access * %5bProtect Credentials Within a Connection String in Code%7cEncryptedConnStringCode%5d *%28%5bC%23%7cEncryptedConnStringCode%5d %7c %5bVB.NET%7cEncryptedConnStringCode2%29%5d* * %5bUsing Parameterized Queries for Secure Database Access%7cParamQueryCode%5d *%28%5bC%23%7cParamQueryCode%5d %7c %5bVB.NET%7cParamQueryCode2%29%5d* * %5bUsing Stored Procedures for Secure Database Access%7cStoredProcCode%5d *%28%5bC%23%7cStoredProcCode%5d %7c %5bVB.NET%7cStoredProcCode2%29%5d* %21%21%21 I/O * %5bCreating a temporary file which avoids canonicalization and race conditions%7cSecureFileCreationCode%5d *%28%5bC%23%7cSecureFileCreationCode%5d %7c %5bVB.NET%7cSecureFileCreationCode2%29%5d* * %5bSecurely Executing a New Process from a .NET Application%7cSecureProcessExecCode%5d *%28%5bC%23%7cSecureProcessExecCode%5d %7c %5bVB.NET%7cSecureProcessExecCode2%29%5d* %21%21%21 Input and Data Validation * %5bEncoding Output within a DataTable%7cEncryptOutputDataTableCode%5d *%28%5bC%23%7cEncryptOutputDataTableCode%5d %7c %5bVB.NET%7cEncryptOutputDataTableCode2%29%5d* * %5bScoping Data Retrieval from the Request Object%7cRequestObjectScopingCode%5d *%28%5bC%23%7cRequestObjectScopingCode%5d %7c %5bVB.NET%7cRequestObjectScopingCode2%29%5d* * %5bValidate User Input with Regular Expressions%7cRegExInputValCode%5d *%28%5bC%23%7cRegExInputValCode%5d %7c %5bVB.NET%7cRegExInputValCode2%29%5d* %21%21%21 Registry * %5bProtect Data in the Registry Using Key Permissions%7cRegistryKeyParmsCode%5d *%28%5bC%23%7cRegistryKeyParmsCode%5d %7c %5bVB.NET%7cRegistryKeyParmsCode2%29%5d* %21%21%21 ViewState * %5bEncrypting ViewState%7cEncryptViewStateCode%5d *%28%5bC%23%7cEncryptViewStateCode%5d %7c %5bVB.NET%7cEncryptViewStateCode2%29%5d* %21%21%21 Web Services * %5bPerform XML schema validation of Web Service payload%7cXMLValidationCode%5d *%28%5bC%23%7cXMLValidationCode%5d %7c %5bVB.NET%7cXMLValidationCode2%29%5d* ---- %21 More Information * %5bCode Example Template%7cCodeExampleTemplate%5d * %5bCode example candidate list%7cCodeExampleCandidates%5d ---- %21 Archive * %5bSecurity Code Examples 1%7cSecurityCodeExamples1%5d * %5bSecurity Code Examples 2%7cSecurityCodeExamples2%5d ---- Return to %5bHomePage%5d
HTML
Preview
Cancel
Save
Edit
Delete
Edit
Comment on Post
Delete
Edit
Reply
In reply to {0}
Download:
[Pending]
Delete
Edit
Reply
In reply to {0}
Download:
[Pending]
Delete
Edit
Reply
In reply to {0}
Download:
[Pending]
Delete
Edit
Reply
In reply to {0}
Download:
[Pending]
Delete
Edit
Reply
In reply to {0}
Download:
[Pending]
Delete
Edit
Reply
In reply to {0}
Download:
[Pending]
Delete
Edit
Reply
In reply to {0}
Download:
[Pending]
Delete
Edit
Reply
In reply to {0}
Download:
[Pending]
Delete
Edit
Reply
In reply to {0}
Download:
[Pending]
Delete
Edit
Comment on Post
Be the first to comment!
Reply
Reply to root
In reply to {0}
Start related discussion
Forum:
Site Feedback
Tech Off
The 9 Guy Around The World
The Coffeehouse
Subject:
Design
HTML
Preview
Tags
*Loading available tags
Separate tags using commas like this: Xbox, Windows Vista, Gaming
(view existing tags)
File:
[No File]
Add File
Remove
Cancel
Attach one file of type: Zip, PDF, XPS, Office Document (.doc, .docx, etc.), Image (PNG, JPG, GIF)
Cancel
Saving...
History
Modified By:
System
Apr 30th @ 11:12 AM
Views (70)
Share
Del.icio.us
Digg
FriendFeed
Facebook
Markup Quick Guide
*bold*
_italics_
+underline+
! Heading 1
!! Heading 2
* Bullet List
** Bullet List 2
# Number List
## Number List 2
[another wiki page]
[url:http://www.example.com]
[image:example.gif]
{"Do not apply formatting"}