비밀번호를 안전하게 저장하세요사용자가 매번 비밀번호를 입력할 필요가 없도록 비밀번호를 안전하게 저장하는 방법이 있습니까?
나는 암호를 기본 설정 파일이나 그와 유사한 것에 일반 텍스트로 저장하고 싶지 않습니다.
Names default to here(1);
nw = new window("Login",
lineupbox(ncol(2),
textbox("Username"), teb_uid = texteditbox("Vincent", <<SET width=""></SET>Re: 비밀번호를 안전하게 저장하세요다음은 powershell에서 사용 가능한 모듈을 사용하는 버전입니다. 아마도 옵션일까요?
Names default to here(1);
loadmodule = "
if (!(Get-Module -ListAvailable -Name CredentialManager)) {
Install-Module CredentialManager -force -Scope CurrentUser
}
";
//Function to run command in powershell, strips trailing line breaks
RunPowershell = Function( {command},
Regex(RunProgram(
Executable( "powershell.exe" ),
Options( {"/c", command } ),
ReadFunction( "text" )
), "^(.*?)[\r\n]+$", "\1")
);
// Set password
SetPass = Function( {target,user,pass},
RunPowershell(
"$target = '" || target || "'
$usr = '" || user || "'
$pswd = '" || pass || "'
" || loadmodule || "
New-StoredCredential -Target $target -UserName $usr -Password $pswd"
);
1; //password is returned as free text, don't return the response
);
// Get password
GetPass = Function( {target},
RunPowershell(
"$target = '" || target || "'
" || loadmodule || "
$creds = Get-StoredCredential -Target $target
$creds.GetNetworkCredential().Password"
)
);
// Get username
GetUser = Function( {target},
RunPowershell(
"$target = '" || target || "'
" || loadmodule || "
$creds = Get-StoredCredential -Target $target
$creds.GetNetworkCredential().UserName"
)
);
// Set and retrieve credentials
SetPass("testcredential", "myusername3", "mypassword3");
GetPass("testcredential");
GetUser("testcredential");
//You can delete these test credentials using the 'windows credential store'.Re: 비밀번호를 안전하게 저장하세요Windows에서는 I 믿다 이 코드는 JSL을 사용하여 다시 생성될 수 있으며 Windows 자격 증명 관리자와 상호 작용하는 명령줄이 잘못되었을 수 있습니다.어쩌면 언젠가는 내가 이 일을 맡게 될지도 모릅니다. 다른 사람이 먼저 알아낼 경우를 대비하여 여기에서 공유하세요. 
<SPAN class="com">#include</SPAN> <SPAN class="str"><WINDOWS.H></WINDOWS.H></SPAN>
<SPAN class="com">#include</SPAN> <SPAN class="str"><WINCRED.H></WINCRED.H></SPAN>
<SPAN class="com">#include</SPAN> <SPAN class="str"><TCHAR.H></TCHAR.H></SPAN>
<SPAN class="com">#pragma</SPAN><SPAN class="pln"> hdrstop
</SPAN><SPAN class="kwd">void</SPAN><SPAN class="pln"> main </SPAN><SPAN class="pun">()</SPAN>
<SPAN class="pun">{</SPAN>
<SPAN class="pun">{</SPAN> <SPAN class="com">//--- SAVE</SPAN>
<SPAN class="kwd">char</SPAN><SPAN class="pun">*</SPAN><SPAN class="pln"> password </SPAN><SPAN class="pun">=</SPAN> <SPAN class="str">"brillant"</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln"> DWORD cbCreds </SPAN><SPAN class="pun">=</SPAN> <SPAN class="lit">1</SPAN> <SPAN class="pun">+</SPAN><SPAN class="pln"> strlen</SPAN><SPAN class="pun">(</SPAN><SPAN class="pln">password</SPAN><SPAN class="pun">);</SPAN><SPAN class="pln">
CREDENTIALW cred </SPAN><SPAN class="pun">=</SPAN> <SPAN class="pun">{</SPAN><SPAN class="lit">0</SPAN><SPAN class="pun">};</SPAN><SPAN class="pln"> cred</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">Type</SPAN> <SPAN class="pun">=</SPAN><SPAN class="pln"> CRED_TYPE_GENERIC</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln"> cred</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">TargetName</SPAN> <SPAN class="pun">=</SPAN><SPAN class="pln"> L</SPAN><SPAN class="str">"FOO/account"</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln"> cred</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">CredentialBlobSize</SPAN> <SPAN class="pun">=</SPAN><SPAN class="pln"> cbCreds</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln"> cred</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">CredentialBlob</SPAN> <SPAN class="pun">=</SPAN> <SPAN class="pun">(</SPAN><SPAN class="pln">LPBYTE</SPAN><SPAN class="pun">)</SPAN><SPAN class="pln"> password</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln"> cred</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">Persist</SPAN> <SPAN class="pun">=</SPAN><SPAN class="pln"> CRED_PERSIST_LOCAL_MACHINE</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln"> cred</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">UserName</SPAN> <SPAN class="pun">=</SPAN><SPAN class="pln"> L</SPAN><SPAN class="str">"paula"</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln">
BOOL ok </SPAN><SPAN class="pun">=</SPAN> <SPAN class="pun">::</SPAN><SPAN class="typ">CredWriteW</SPAN> <SPAN class="pun">(&</SPAN><SPAN class="pln">cred</SPAN><SPAN class="pun">,</SPAN> <SPAN class="lit">0</SPAN><SPAN class="pun">);</SPAN><SPAN class="pln"> wprintf </SPAN><SPAN class="pun">(</SPAN><SPAN class="pln">L</SPAN><SPAN class="str">"CredWrite() - errno %d\n"</SPAN><SPAN class="pun">,</SPAN><SPAN class="pln"> ok </SPAN><SPAN class="pun">?</SPAN> <SPAN class="lit">0</SPAN> <SPAN class="pun">:</SPAN> <SPAN class="pun">::</SPAN><SPAN class="typ">GetLastError</SPAN><SPAN class="pun">());</SPAN>
<SPAN class="kwd">if</SPAN> <SPAN class="pun">(!</SPAN><SPAN class="pln">ok</SPAN><SPAN class="pun">)</SPAN> <SPAN class="kwd">exit</SPAN><SPAN class="pun">(</SPAN><SPAN class="lit">1</SPAN><SPAN class="pun">);</SPAN>
<SPAN class="pun">}</SPAN>
<SPAN class="pun">{</SPAN> <SPAN class="com">//--- RETRIEVE</SPAN><SPAN class="pln"> PCREDENTIALW pcred</SPAN><SPAN class="pun">;</SPAN><SPAN class="pln"> BOOL ok </SPAN><SPAN class="pun">=</SPAN> <SPAN class="pun">::</SPAN><SPAN class="typ">CredReadW</SPAN> <SPAN class="pun">(</SPAN><SPAN class="pln">L</SPAN><SPAN class="str">"FOO/account"</SPAN><SPAN class="pun">,</SPAN><SPAN class="pln"> CRED_TYPE_GENERIC</SPAN><SPAN class="pun">,</SPAN> <SPAN class="lit">0</SPAN><SPAN class="pun">,</SPAN> <SPAN class="pun">&</SPAN><SPAN class="pln">pcred</SPAN><SPAN class="pun">);</SPAN><SPAN class="pln"> wprintf </SPAN><SPAN class="pun">(</SPAN><SPAN class="pln">L</SPAN><SPAN class="str">"CredRead() - errno %d\n"</SPAN><SPAN class="pun">,</SPAN><SPAN class="pln"> ok </SPAN><SPAN class="pun">?</SPAN> <SPAN class="lit">0</SPAN> <SPAN class="pun">:</SPAN> <SPAN class="pun">::</SPAN><SPAN class="typ">GetLastError</SPAN><SPAN class="pun">());</SPAN>
<SPAN class="kwd">if</SPAN> <SPAN class="pun">(!</SPAN><SPAN class="pln">ok</SPAN><SPAN class="pun">)</SPAN> <SPAN class="kwd">exit</SPAN><SPAN class="pun">(</SPAN><SPAN class="lit">1</SPAN><SPAN class="pun">);</SPAN><SPAN class="pln"> wprintf </SPAN><SPAN class="pun">(</SPAN><SPAN class="pln">L</SPAN><SPAN class="str">"Read username = '%s', password='%S' (%d bytes)\n"</SPAN><SPAN class="pun">,</SPAN><SPAN class="pln">
pcred</SPAN><SPAN class="pun">-></SPAN><SPAN class="typ">UserName</SPAN><SPAN class="pun">,</SPAN> <SPAN class="pun">(</SPAN><SPAN class="kwd">char</SPAN><SPAN class="pun">*)</SPAN><SPAN class="pln">pcred</SPAN><SPAN class="pun">-></SPAN><SPAN class="typ">CredentialBlob</SPAN><SPAN class="pun">,</SPAN><SPAN class="pln"> pcred</SPAN><SPAN class="pun">-></SPAN><SPAN class="typ">CredentialBlobSize</SPAN><SPAN class="pun">);</SPAN>
<SPAN class="com">// must free memory allocated by CredRead()!</SPAN>
<SPAN class="pun">::</SPAN><SPAN class="typ">CredFree</SPAN> <SPAN class="pun">(</SPAN><SPAN class="pln">pcred</SPAN><SPAN class="pun">);</SPAN>
<SPAN class="pun">}</SPAN>
<SPAN class="pun">}</SPAN>kkm에서 여기:
https://stackoverflow.com/questions/9221245/how-do-i-store-and-retrieve-credentials-from-the-windows-vault-credential-manage
Re: 비밀번호를 안전하게 저장하세요당신은 도움이 되었습니다.감사합니다.
Re: 비밀번호를 안전하게 저장하세요JMP 추가 기능을 사용하여 암호화를 수행하는 방법을 살펴볼 수 있습니다. 암호화 라이브러리 배송에는 법적 영향과 수출 영향이 있다는 점을 이해하세요. 가장 좋은 방법은 이미 호스트 OS에 있는 기본 암호화 라이브러리를 호출하는 추가 기능을 작성한 다음 법무팀을 통해 계속 실행하는 것입니다.
Re: 비밀번호를 안전하게 저장하세요나는 이것을 좋아한다.불행히도 고객에게 Python을 설치하도록 강요할 수는 없습니다(일부는 사용자가 Python을 설치하는 것을 명시적으로 금지했습니다).그러나 나는 대부분의 사람들이 sqlite odbc 드라이버를 설치하여 MD5와 함께 사용할 수 있다고 확신했습니다.
아직 암호화할 수 있는 방법을 찾아야 합니다.
도움을 주셔서 감사합니다. 확실히 조사해야 할 부분이 있습니다.
Re: 비밀번호를 안전하게 저장하세요나는 난독화 스타일 경로.문자를 숫자로 변환한 다음 이 숫자를 수학 공식에 입력하여 '암호화된' 표현을 생성합니다.
나는 사용자 비밀번호보다는 소프트웨어 라이센스 코드에 이 기술을 더 많이 사용하는 경향이 있습니다.따라서 사이트 ID 정보와 만료 날짜를 결합한 제품 이름이나 코드를 사용하여 숫자 표현을 구축하고 이를 복잡한 수학 공식을 통해 구문 분석합니다. 최종 출력은 1143932720966과 같을 수 있습니다.
Re: 비밀번호를 안전하게 저장하세요나 자신을 위해 더 나은 솔루션을 찾는 동안 이것을 발견했습니다.내 컴퓨터의 스크립트의 경우 R을 호출하고 키링 기능을 사용합니다.Mac에서는 키체인, Windows에서는 Credential Store, Linux에서는 Secret Service API를 사용합니다.분명히 이것은 오버헤드를 동반하므로 R 없이 이 작업을 수행하는 것이 좋을 것입니다.관심이 있다면 이러한 기능을 생성하기 위한 JMP 위시리스트 항목 JMP에서.
https://github.com/r-lib/keyring
R Init();
R Submit(
"library(keyring)
pw <- keyring::key_get(\!"DomainAccount\!", \!"username\!")"
);
pw = R Get("pw");
R Term();Re: 비밀번호를 안전하게 저장하세요sqlite 데이터 저장소를 생성하기 위한 샘플 Python 스크립트,
#! /usr/bin/env/python3
#
# Author: Paul Nelson - JMP Statistical Discovery, From SAS
# Date: 9 Mar 2020
#
# Description: This sample shows the python code using sqlite to create a data data store
# for saving passwords, credentails... While Python has hash functions, the standard library
# does not include ciphers. For purposes of this sample I used lzma compression to 'encode' and
# decompression to 'decrypt' For use from JSL, I would turn this into a python module and then
# import 'my_dataStore_api' to cut down code in the JSL string.
#
# sample python program using sqlite to create a secure store for passwords and
# key, value data storage.
#
# While Python contains hash functions, does not include encryption primitives in the standard library.
# an example using PyCrypto can be found
# https://stackoverflow.com/questions/12524994/encrypt-decrypt-using-pycrypto-aes-265
# however pycrypto has no been updated since 2014... https://github.com/dlitz/pycrypto
#
# pyca/cryptography - https://cryptography.io/ https://github.com/pyca/cryptography
# seems to be currently maintained.
#
# Don't create your own encryption! The above packages or, openssl, or many other providers are
# better than writing your own.
#
# It is an exercise left to the reader to replace the code using lzma compression with real encrypt
# and decrypt code.
#
#
import sqlite3
import hashlib
import os
from pathlib import Path
import lzma
# Salt should be random quantity, get from OS entropy source
salt = os.urandom(16);
mypasswd = b'JMP in a dried up lake'
dk = hashlib.pbkdf2_hmac('sha256', mypasswd, salt, 1000)
# dk.hex() will be the actual hashed password saved to db
# but the binary dk, will be what we use as the encryption key
# dkhex = dk.hex()
# binDk = bytes.fromhex(dkhex)
#
# Path to my credential store , my home directory + AppData
data_path = str(Path.home()) + '/AppData/'
filename = 'dataStore'
# Create directory if it doesn't exist
os.makedirs(data_path, exist_ok=True)
# will create database if it doesn't exist
db = sqlite3.connect(data_path + filename + '.db')
# my username
me = 'jmpuser'
# create our password table storing hashed passwords
db.execute('CREATE TABLE IF NOT EXISTS passwd (uid INTEGER PRIMARY KEY, name TEXT, salt TEXT, key TEXT)')
# should check to see if user is in database and only insert if not found
# exercise left to the reader
db.execute("INSERT INTO passwd (name, salt, key) VALUES( ?,?,? ) ", (me, salt.hex(), dk.hex()) )
db.commit()
print('******* passwd database *******')
for row in db.execute('SELECT * from passwd'):
print(row)
print('*******************************')
# create our credentials table which will store the name of the credential, and its value
db.execute('CREATE TABLE IF NOT EXISTS credentials (id INTEGER PRIMARY KEY, uid INTEGER, key TEXT, value TEXT)')
# first we need to have validated that user gave propper password, and we authenticated against passwd
# table assuming user is authenticated
# should check to see if user is in database and only insert if not found, potentially update if found
# exercise left to the reader.
# my user id in this scheme
id = 0
#The value data I'm going to store into the database
myson1 = """
{
user: paul
magic_key: JMP Rocks!
}"""
myson2 = """
{
user: paul
magic_key: supercalifragilisticexpialidocious
}"""
# 'encrypt' my data
lvalue = lzma.compress( myson2.encode() )
lvalue2 = lzma.compress( myson1.encode() )
# you could encrypt the 'key' as well as the value if you really want security
db.execute("INSERT INTO credentials (uid, key, value) VALUES( ?,?,? ) ", (id, 'JMPCommunity', lvalue.hex()) )
db.execute("INSERT INTO credentials (uid, key, value) VALUES( ?,?,? ) ", (id, 'WDW', lvalue2.hex()) )
db.commit()
print('******* credentials database *******')
for row in db.execute('SELECT * from credentials WHERE uid=?', (id,) ):
print(row)
value = bytes.fromhex(row[3])
print(lzma.decompress(value).decode())
print('************************************')
db.close()
Re: 비밀번호를 안전하게 저장하세요자격 증명을 안전하게 저장하는 것은 어려운 문제입니다. 올바르게 하는 것은 정말 어렵습니다. 최소한 보호하려는 비밀의 무단 사용을 방지하기 위해 사용자가 세션당 한 번씩 어떤 형태의 자격 증명을 입력해야 할 가능성이 높습니다. 따라서 각 '사용자'에 대해 자격 증명 저장소의 비밀번호를 저장해야 할 가능성이 높습니다. 그런 다음 자격 증명 저장소 자체가 필요합니다. 얼마나 안전합니까? rot13과 같은 간단한 대체 암호(알파벳 문자를 13만큼 이동하여 m => z, a =>n)와 같은 난독화가 필요합니까, 아니면 AES 암호화 또는 공개 키 암호화와 같은 더 강력한 암호화가 필요합니까? JMP 테이블, 텍스트 파일 또는 데이터베이스 테이블을 사용하여 데이터 저장소를 생성할 수 있습니다. JMP는 데이터베이스 연결을 위한 ODBC를 지원합니다. JSL로 작성되거나 JMP의 추가 기능 또는 Python 브리지를 통해 공유 라이브러리에서 로드되는 더 나은 체크섬 및 암호화 지원.
비밀번호 보안,
비밀번호 파일을 유지하는 전통적인 방법은 해시 기능을 사용하여 파일을 보호합니다. 한 가지 방법에는 MD5, SHA 제품군, SHA1, SHA256 등과 같은 기능이 모두 데이터를 가져와 원본 데이터를 공개하기 위해 되돌릴 수 없는 해시를 생성합니다. 아이디어는 보호하려는 데이터를 가져와 데이터에서 해시를 생성하는 것입니다. 일반적으로 이러한 해시는 비밀번호 데이터와 함께 저장되는 임의의 값인 SALT 값으로 혼합됩니다. 솔트를 사용하면 알려진 데이터의 조회 테이블을 해시 값으로 유지하는 데 훨씬 더 많은 비용이 듭니다. 그런 다음 사용자가 비밀번호를 입력하면 입력한 값을 해시하고 저장된 값과 해시를 비교합니다.일치하면 == 성공이고 비밀번호가 검증됩니다. JMP는 MD5 체크섬을 JSL에 공개합니다. 스크립팅 인덱스에서 Blob MD5()를 참조하세요. 암호화 목적으로 MD5를 사용하는 것은 최신 암호화 기술에 비해 안전하지 않지만 낮은 수준의 보안에는 여전히 괜찮습니다.
그런 다음 해시를 사용하거나 해시를 추가 데이터와 결합하여 파생 해시 또는 HMAC를 만들 수도 있습니다. https://en.wikipedia.org/wiki/HMAC 보호된 데이터 저장소의 비밀번호 키 역할을 합니다. 일부 데이터베이스에는 데이터 필드에 대한 암호화 기능이 있습니다. 그렇지 않으면 데이터를 직접 암호화하여 테이블에 저장해야 할 수도 있습니다.
마지막으로 더 강력한 보안이 필요하다면 공유 라이브러리를 호출할 수 있는 JMP의 추가 기능을 살펴보세요. 거기서 원하는 만큼 복잡한 데이터 관리 체계를 구현할 수 있습니다. 또는 JMP의 Python 인터페이스를 살펴보세요. Python 패키지를 호출하면 sqlite에 액세스할 수 있고 더 나은 체크섬과 암호화 방법을 얻을 수 있습니다.
그러한 데이터 저장소를 구축하려면 어떻게 해야 합니까? 나는 JMP의 Python 인터페이스에 크게 의존할 것입니다. sqlite 데이터베이스 지원은 Python에 내장되어 있으며 내 데이터 저장소에 해당 테이블이나 JMP 테이블을 사용합니다. 또한 Python은 일반적으로 암호화 지원, 체크섬 및 암호화 알고리즘으로 구축됩니다. 먼저 비밀번호 해시가 포함된 비밀번호 테이블 테이블을 만드는 것부터 시작하겠습니다. 그런 다음 암호화된 필드가 있는 다른 테이블로 데이터 저장소를 구축합니다. 얼마나 안전하고, 얼마나 복잡하고, 코드 양과 테스트 양이 얼마나 중요한지...
Re: 비밀번호를 안전하게 저장하세요누군가 아이디어가 있는지 확인하기 위해 이것을 부딪히려고 노력할 것이라고 생각했습니다.
이제는 다른 유형의 비밀에도 문제가 있기 때문입니다.사용자 액세스 코드 및 기타 사항.
Re: 비밀번호를 안전하게 저장하세요그러려면 모든 사용자의 비밀번호에 액세스할 수 있어야 합니다.확실히 불가능합니다.그리고 사용자에게 비밀번호를 암호화된 스크립트로 저장하라고 지시하는 것도 실행 가능한 옵션이 아닙니다.나는 프로그래밍 방식으로 입력하는 사용자 이름/비밀번호를 저장할 수 있는 "기억하기" 옵션을 원하지만 해당 저장 공간은 안전합니다.
Re: 비밀번호를 안전하게 저장하세요연관 배열이나 목록 등에 비밀번호가 포함된 스크립트를 만듭니다. 그런 다음 해당 스크립트를 암호화된 스크립트로 저장합니다.