Sign In
Home
Recent
Media
Videos
Podcasts
Screencasts
Shows
Continuum
ARCast.TV
This Week On Channel 9
See All Shows...
Forums
Coffeehouse
Tech Off
Feedback
Sandbox
Wiki
Search
About
Subscribe
securitycodeexamples2
Cancel
Save
Edit
Return to
HomePage
Code Examples Index
This page is a catalog of security code examples. Each example is a discreet block of code that includes the intentions and insight behind the code. The examples were drawn from a
code example candidate list
C#
Authentication
*
Hash a Password Using a Random Salt (C)
Cookies
*
Setting application and ASP.NET 2.0 cookies securely (C)
*
Encrypting and Signing a cookie for use by an external web application (C)
*
Decrypt validate encrypted signed cookie (C)
Cryptogrpahy
*
Generate RSA Keys and Store in the Registry Using DPAPI (C)
*
Decrypt a file via a block cipher using AES (C)
*
Decrypt a file via a block cipher using 3DES (C)
*
Decrypt a string via a block cipher using AES (C)
*
Decrypt a string via a block cipher using 3DES (C)
*
Encrypt a file via a block cipher using AES (C)
*
Encrypt a file via a block cipher using 3DES (C)
*
Export the Public Key from an RSA Key Pair for Distribution (C)
*
Creating and securely storing a symmetric encryption key and Initialization Vector (C)
*
Generate a Message Authentication Code (C)
*
Generate an RSA signature of a given message (C)
*
Import an RSA Public Key from a file and Encrypt a Message (C)
*
Retrieve an RSA Key Pair from the Registry and Decrypt a Message (C)
*
Generate an RSA signature of a given message (C)
Data Access
*
Protect Credentials Within a Connection String in Code (C)
*
Using Parameterized Queries for Secure Database Access (C)
*
Using Stored Procedures for Secure Database Access (C)
I/O
*
Creating a temporary file which avoids canonicalization and race conditions (C)
*
Securely Executing a New Process from a .NET Application (C)
Input and Data Validation
*
Encoding Output within a (C)
*
Validate User Input with Regular Expressions (C)
*
Scoping Data Retrieval from the Request Object (C)
Registry
*
Protect Data in the Registry Using Key Permissions (C)
ViewState
*
Encrypting (C)
Web Services
*
Perform XML schema validation of Web Service payload (C)
VB.NET
Authentication
*
Hash a Password Using a Random Salt (VB.NET)
Cookies
*
Setting application and ASP.NET 2.0 cookies securely (VB.NET)
*
Encrypting and Signing a cookie for use by an external web application (VB.NET)
*
Decrypt validate encrypted signed cookie (VB.NET)
Cryptogrpahy
*
Generate RSA Keys and Store in the Registry Using DPAPI (VB.NET)
*
Generating Cryptographically Secure Random Numbers (VB.NET)
*
Decrypt a file via a block cipher using AES (VB.NET)
*
Decrypt a file via a block cipher using 3DES (VB.NET)
*
Decrypt a string via a block cipher using AES (VB.NET)
*
Decrypt a string via a block cipher using 3DES (VB.NET)
*
Encrypt a file via a block cipher using AES (VB.NET)
*
Encrypt a file via a block cipher using 3DES (VB.NET)
*
Export the Public Key from an RSA Key Pair for Distribution (VB.NET)
*
Creating and securely storing a symmetric encryption key and Initialization Vector (VB.NET)
*
Generate a Message Authentication Code (VB.NET)
*
Generate an RSA signature of a given message (VB.NET)
*
Import an RSA Public Key from a file and Encrypt a Message (VB.NET)
*
Retrieve an RSA Key Pair from the Registry and Decrypt a Message (VB.NET)
*
Generate an RSA signature of a given message (VB.NET)
Data Access
*
Protect Credentials Within a Connection String in Code (VB.NET)
*
Using Parameterized Queries for Secure Database Access (VB.NET)
*
Using Stored Procedures for Secure Database Access (VB.NET)
I/O
*
Creating a temporary file which avoids canonicalization and race conditions (VB.NET)
*
Securely Executing a New Process from a .NET Application (VB.NET)
Input and Data Validation
*
Encoding Output within a (VB.NET)
*
Validate User Input with Regular Expressions (VB.NET)
*
Scoping Data Retrieval from the Request Object (VB.NET)
Registry
*
Protect Data in the Registry Using Key Permissions (VB.NET)
ViewState
*
Encrypting (VB.NET)
Web Services
*
Perform XML schema validation of Web Service payload (VB.NET)
More Information
*
Code Example Template
*
Code example candidate list
Archive
*
Security Code Examples 1
Return to
HomePage
Return to %5bHomePage%5d ---- %21 Code Examples Index This page is a catalog of security code examples. Each example is a discreet block of code that includes the intentions and insight behind the code. The examples were drawn from a %5bcode example candidate list%7cCodeExampleCandidates%5d %21 C%23 %21%21%21 Authentication * %5bHash a Password Using a Random Salt %28C%23%29%7cSaltedHashCode%5d %21%21%21 Cookies * %5bSetting application and ASP.NET 2.0 cookies securely %28C%23%29%7cCookieModesCode%5d * %5bEncrypting and Signing a cookie for use by an external web application %28C%23%29%7cCreateCookieCode%5d * %5bDecrypt validate encrypted signed cookie %28C%23%29%7cDecryptCookieCode%5d %21%21%21 Cryptogrpahy * %5bGenerate RSA Keys and Store in the Registry Using DPAPI %28C%23%29%7cCreateRSACode%5d * %5bDecrypt a file via a block cipher using AES %28C%23%29%7cDecryptFileAESCode%5d * %5bDecrypt a file via a block cipher using 3DES %28C%23%29%7cDecryptFileTripleDESCode%5d * %5bDecrypt a string via a block cipher using AES %28C%23%29%7cDecryptStringAESCode%5d * %5bDecrypt a string via a block cipher using 3DES %28C%23%29%7cDecryptStringTripleDesCode%5d * %5bEncrypt a file via a block cipher using AES %28C%23%29%7cEncryptFileAESCode%5d * %5bEncrypt a file via a block cipher using 3DES %28C%23%29%7cEncryptFileTripleDesCode%5d * %5bExport the Public Key from an RSA Key Pair for Distribution %28C%23%29%7cExportRSAKeyCode%5d * %5bCreating and securely storing a symmetric encryption key and Initialization Vector %28C%23%29%7cGenerateCryptoKeyCode%5d * %5bGenerate a Message Authentication Code %28C%23%29%7cGenerateHMacCode%5d * %5bGenerate an RSA signature of a given message %28C%23%29%7cGenerateRSASigCode%5d * %5bImport an RSA Public Key from a file and Encrypt a Message %28C%23%29%7cImportRSACode%5d * %5bRetrieve an RSA Key Pair from the Registry and Decrypt a Message %28C%23%29%7cRetrieveRSAKeyCode%5d * %5bGenerate an RSA signature of a given message %28C%23%29%7cValidateRSASigCode%5d %21%21%21 Data Access * %5bProtect Credentials Within a Connection String in Code %28C%23%29%7cEncryptedConnStringCode%5d * %5bUsing Parameterized Queries for Secure Database Access %28C%23%29%7cParamQueryCode%5d * %5bUsing Stored Procedures for Secure Database Access %28C%23%29%7cStoredProcCode%5d %21%21%21 I/O * %5bCreating a temporary file which avoids canonicalization and race conditions %28C%23%29%7cSecureFileCreationCode%5d * %5bSecurely Executing a New Process from a .NET Application %28C%23%29%7cSecureProcessExecCode%5d %21%21%21 Input and Data Validation * %5bEncoding Output within a %28C%23%29%7cEncryptOutputDataTableCode%5d * %5bValidate User Input with Regular Expressions %28C%23%29%7cRegExInputValCode%5d * %5bScoping Data Retrieval from the Request Object %28C%23%29%7cRequestObjectScopingCode%5d %21%21%21 Registry * %5bProtect Data in the Registry Using Key Permissions %28C%23%29%7cRegistryKeyParmsCode%5d %21%21%21 ViewState * %5bEncrypting %28C%23%29%7cEncryptViewStateCode%5d %21%21%21 Web Services * %5bPerform XML schema validation of Web Service payload %28C%23%29%7cXMLValidationCode%5d %21 VB.NET %21%21%21 Authentication * %5bHash a Password Using a Random Salt %28VB.NET%29%7cSaltedHashCode2%5d %21%21%21 Cookies * %5bSetting application and ASP.NET 2.0 cookies securely %28VB.NET%29%7cCookieModesCode2%5d * %5bEncrypting and Signing a cookie for use by an external web application %28VB.NET%29%7cCreateCookieCode2%5d * %5bDecrypt validate encrypted signed cookie %28VB.NET%29%7cDecryptCookieCode2%5d %21%21%21 Cryptogrpahy * %5bGenerate RSA Keys and Store in the Registry Using DPAPI %28VB.NET%29%7cCreateRSACode2%5d * %5bGenerating Cryptographically Secure Random Numbers %28VB.NET%29%7cSecureRNGCode2%5d * %5bDecrypt a file via a block cipher using AES %28VB.NET%29%7cDecryptFileAESCode2%5d * %5bDecrypt a file via a block cipher using 3DES %28VB.NET%29%7cDecryptFileTripleDESCode2%5d * %5bDecrypt a string via a block cipher using AES %28VB.NET%29%7cDecryptStringAESCode2%5d * %5bDecrypt a string via a block cipher using 3DES %28VB.NET%29%7cDecryptStringTripleDesCode2%5d * %5bEncrypt a file via a block cipher using AES %28VB.NET%29%7cEncryptFileAESCode2%5d * %5bEncrypt a file via a block cipher using 3DES %28VB.NET%29%7cEncryptFileTripleDesCode2%5d * %5bExport the Public Key from an RSA Key Pair for Distribution %28VB.NET%29%7cExportRSAKeyCode2%5d * %5bCreating and securely storing a symmetric encryption key and Initialization Vector %28VB.NET%29%7cGenerateCryptoKeyCode2%5d * %5bGenerate a Message Authentication Code %28VB.NET%29%7cGenerateHMacCode2%5d * %5bGenerate an RSA signature of a given message %28VB.NET%29%7cGenerateRSASigCode2%5d * %5bImport an RSA Public Key from a file and Encrypt a Message %28VB.NET%29%7cImportRSACode2%5d * %5bRetrieve an RSA Key Pair from the Registry and Decrypt a Message %28VB.NET%29%7cRetrieveRSAKeyCode2%5d * %5bGenerate an RSA signature of a given message %28VB.NET%29%7cValidateRSASigCode2%5d %21%21%21 Data Access * %5bProtect Credentials Within a Connection String in Code %28VB.NET%29%7cEncryptedConnStringCode2%5d * %5bUsing Parameterized Queries for Secure Database Access %28VB.NET%29%7cParamQueryCode2%5d * %5bUsing Stored Procedures for Secure Database Access %28VB.NET%29%7cStoredProcCode2%5d %21%21%21 I/O * %5bCreating a temporary file which avoids canonicalization and race conditions %28VB.NET%29%7cSecureFileCreationCode2%5d * %5bSecurely Executing a New Process from a .NET Application %28VB.NET%29%7cSecureProcessExecCode2%5d %21%21%21 Input and Data Validation * %5bEncoding Output within a %28VB.NET%29%7cEncryptOutputDataTableCode2%5d * %5bValidate User Input with Regular Expressions %28VB.NET%29%7cRegExInputValCode2%5d * %5bScoping Data Retrieval from the Request Object %28VB.NET%29%7cRequestObjectScopingCode2%5d %21%21%21 Registry * %5bProtect Data in the Registry Using Key Permissions %28VB.NET%29%7cRegistryKeyParmsCode2%5d %21%21%21 ViewState * %5bEncrypting %28VB.NET%29%7cEncryptViewStateCode2%5d %21%21%21 Web Services * %5bPerform XML schema validation of Web Service payload %28VB.NET%29%7cXMLValidationCode2%5d ---- %21 More Information * %5bCode Example Template%7cCodeExampleTemplate%5d * %5bCode example candidate list%7cCodeExampleCandidates%5d ---- %21 Archive * %5bSecurity Code Examples 1%7cSecurityCodeExamples1%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:14 AM
Views (10)
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"}