Firefox 암호 데이터베이스 (해당 파일은 프로필 폴더에 signons.sqlite
)에서 암호를 추출하는 간단한 유틸리티를 작성하고 싶습니다.Firefox 암호 데이터베이스 암호 해독
나는 지금까지 해왔 던 작업 : sqlite를 사용하여 데이터베이스를 열고 암호화 된 사용자 이름, 암호화 된 암호 및 웹 사이트 주소 (모두 std::string
)를 열었습니다.
남은 유일한 것은 사용자 이름과 암호 문자열을 해독하는 것입니다.
나는 다음 (PK11Decrypt
가
plaintext
에 일반 텍스트 암호를 저장한다고) 시도 :
PK11Decrypt
가 호출
void Firefox_Importer::PK11Decrypt(string _cipheredBuffer, char **plaintext) {
// declarations needed
SECItem * request;
SECItem * reply;
unsigned int len = (unsigned int)_cipheredBuffer.length();
const char* cipheredBuffer = (const char*)_cipheredBuffer.c_str();
// generate request and reply SECItem; seems to work properly
reply = SECITEM_AllocItem(NULL, NULL, 0);
if (reply == NULL) cout << "Error allocating SECITEM." << endl;
request = NSSBase64_DecodeBuffer(NULL, NULL, cipheredBuffer, len);
if (request == NULL) cout << "Error decoding buffer." << endl;
// the following is not working
SECStatus tmp = PK11SDR_Decrypt(request, reply, NULL);
if(tmp != SECSuccess) cout << "Something went wrong during decrypting" << endl;
*plaintext = (char*)malloc(reply->len + 1);
strncpy(*plaintext, (const char*)reply->data, reply->len);
(*plaintext)[reply->len] = '\0';
SECITEM_FreeItem(request, true);
SECITEM_FreeItem(reply, true);
}
, 그것은 PK11SDR_Decrypt
에 대한 호출이 제대로 작동하지 않았 음을 나타내는 Something went wrong during decrypting
를 인쇄합니다. 항상 SECFailure
(-1에 해당)을 반환합니다.
아무도 힌트가 있거나 내가 잘못하고있는 것을 알고 있습니까?
힌트를 보내 주셔서 감사합니다. 실제로 나는 'NSS_Init'을 호출하는 것을 잊어 버린 어리석은 실수를했습니다. 고맙습니다. – phimuemue
@AmitKhandelwal :이 코드는 NSS 라이브러리를 사용하고 있다고 가정하고 모든 운영 체제에서 작동합니다. 단순히 컴퓨터의 데이터베이스에 액세스하려면 superuser.com에서 새로운 질문을하는 것이 좋습니다. –
마스터 비밀번호를 설정하면 어떨까요? 알려진 마스터 비밀번호와 함께 PK11SDR_Decrypt를 사용할 수 있습니까? –