gonss3

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2020 License: LGPL-3.0 Imports: 12 Imported by: 1

README

gonss3

Package documentation: https://godoc.org/github.com/rusq/gonss3

Package gonss implements the subset of Mozilla NSS3 library. It implements just enough to decrypt the firefox profile passwords.

I take no credit, implementation is entirely based on this project which is based on Dr Stephen Henson research for "Netscape Key Databases".

Supports only key4.db (sqlite).

This library is created for educational purposes and licenced under LGPL 3.0.

Usage

package main
import "github.com/rusq/gonss3"

func main() {
  profile, err := gonss3.New("/path/to/profile", []byte("masterpass"))
  // handle err

  userCt, passCt := // fetch some data from logins.json

  user,err := profile.DecryptField(userCt)
  // handle err
  pass,err := profile.DecryptField(passCt)
  // handle err

  fmt.Println(user, pass)
}

TODO

[ ] TESTS

Documentation

Overview

Package gonss3 implements the subset of Mozilla NSS3 library. It implements just enough to decrypt the firefox profile passwords.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncParams

type EncParams struct {
	Encryption asn1.ObjectIdentifier
	IV         []byte
}

EncParams are encryption field encryption parameters.

type EncryptedField

type EncryptedField struct {
	KeyName []byte
	EncParams
	Ct []byte
}

EncryptedField represents an encrypted field (for ASN1 unmarshal).

type MasterKey

type MasterKey struct {
	Salt
	CipherText []byte
}

MasterKey describes the following ASN1 structure:

 SEQUENCE {
  SEQUENCE {
    OBJECTIDENTIFIER 1.2.840.113549.1.12.5.1.3
    SEQUENCE {
      OCTETSTRING entry_salt
      INTEGER 01
    }
  }
  OCTETSTRING encrypted_master_key
}

type Profile

type Profile struct {
	// contains filtered or unexported fields
}

Profile is the Firefox profile.

func New

func New(profilePath string, masterPassword []byte) (*Profile, error)

New opens a firefox profile. Will return error if master key is wrong.

func (*Profile) DecryptField

func (p *Profile) DecryptField(ct64 string) ([]byte, error)

DecryptField decrypts the base64-encoded field from the login file.

type Salt

type Salt struct {
	CipherType asn1.ObjectIdentifier
	SaltValue
}

Salt is cryptographic salt, part of MasterKey.

type SaltValue

type SaltValue struct {
	EntrySalt  []byte
	Iterations int
}

SaltValue is the salt value, part of MasterKey.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL