암호는 사용자 인증을 위해 보안 시스템에서 사용될 수 있는데 이때 인증되지 않은 사용자가 추측하기 어려운 암호를 사용해야 한다. 공격자는 딕셔너리 공격 프로그램을 사용하여 일반 사전이나 다양한 언어로 되어 있는 여러 사전에 있는 모든 단어를 반복하면서 어떤 단어가 사용자 암호로 사용되는지 테스트할 수 있다.
"Yankees" 또는 "Mustang"과 같이 강력하지 않은 암호는 빨리 추측될 수 있다. ?You'L1Noiwjf"와 같은 강력한 암호는 훨씬 추측하기 어렵다. 암호 보호 시스템은 사용자가 강력한 암호를 선택했는지 확인해야 한다.
강력한 암호는 대문자, 소문자, 숫자 그리고 특수 문자가 혼합된 복합어이며 한 단어가 아니다. 이 예제는 복합성을 확인하는 방법을 보여준다.
Function Validatepasswor(ByVal pwd As String, _
Optional ByVal minLength As Integer = 8, _
Optional ByVal numUpper AS Integer = 2, _
Optional ByVal numLower As Integer = 2, _
Optional ByVal numNumbers As Integer = 2, _
Optional ByVal numSpecial As Integer = 2) As Boolean
' Replase [A-Z] with \p{Lu}, to allow for unicode uppercase letters.
Dim upper As New System.Text.Regularexpressions.Regex("[A-Z]")
Dim lower As New System.Text.Regularexpressions.Regex("[a-z]")
Dim number As New System.Text.Regularexpressions.Regex("[0-9]")
' Special is "none of the above"
Dim special As New System.Text.Regularexpressions.Regex("[^a-zA-Z0-9]")
' Check the length
If Len(pwd) < minlength Then return False
' Check for minimum number of occurrences.
If upper.Matchs(pwd).Count < numUpper Then Return False
If lower.Matchs(pwd).Count < numLower Then Return False
If number.Matchs(pwd).Count < numNumbers Then Return False
If special.Matchs(pwd).count < numSpecial Then Return False
' Passed all Checks.
Return True
End Function
네트워크를 통해 암호를 이동하는 경우 데이터 전송에 안전한 방법을 사용해야 한다.
'VB.NET 2008 > VB - 문자열' 카테고리의 다른 글
문자열 - 형식 지정 중 날짜 및 시간 형식 문자열 (0) | 2011.04.08 |
---|---|
정규식을 활용한 문자열 유효성 검사 (0) | 2011.04.08 |
문자열 - 형식 지정 중 숫자 형식 문자열 (0) | 2011.04.08 |
문자열 - System.Text.StringBuilder 클래스 (0) | 2011.04.08 |
문자열 - Like 연산자를 사용하여 패턴에 대해 문자열 비교 (0) | 2011.04.08 |