Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6530931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:48:57+00:00 2026-05-25T09:48:57+00:00

I want to write a simple utility that extracts passwords from a Firefox password

  • 0

I want to write a simple utility that extracts passwords from a Firefox password database (the corresponding file is called signons.sqlite in the profile folder).

What I’ve done so far: Opened database using sqlite, retrieved encrypted username, encrypted password and address of website (all stored as std::string).

So, the only thing remaining is to decrypt the username and password strings.

I tried the following (PK11Decrypt ought to store the plaintext password in plaintext):

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);
}

When PK11Decrypt is called, it prints Something went wrong during decrypting, indicating that the call to PK11SDR_Decrypt didn’t work properly. It always returns SECFailure (which corresponds to -1).

Does anybody have some hints or know what I’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:48:58+00:00Added an answer on May 25, 2026 at 9:48 am

    It could be that the call to PK11_Authenticate() isn’t optional, even if no master password is set (yes, NSS is pretty messed up). So you might need to do the following first:

    PK11SlotInfo *slot = PK11_GetInternalKeySlot();
    if (!slot) cout << "Error getting internal slot" << endl;
    
    SECStatus tmp = PK11_Authenticate(slot, PR_TRUE, NULL);
    if (tmp != SECSuccess) cout << "Authentication error" << endl;
    

    Note that I pass NULL as context to PK11_Authenticate(), the context is only required if a password prompt should be displayed.

    Edit: Never mind, I noticed that PK11SDR_Decrypt() will call both functions internally. Given that you get SECFailure as result, it is likely that PK11_GetInternalKeySlot() fails which would indicate that NSS isn’t initialized properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a simple text file from my winform app in c#
I want to write a simple program, that writes console input to file with
I want to write a simple class (PHP5) that can 'run' an unknown amount
I want to write a simple SMPP Server that basically forwards traffic to another
I want to write a simple bash script that will act as a wrapper
I want to write a simple firefox extension. How can I get a reference
I want to write a simple Outlook 2007 AddIn that allows me to manually
I want to write a simple istream object, that would simply transform another istream
I want to write two simple utilities: Receives a Binary file, and converts it
I want the write a simple application, that input some strings, and do something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.