NTLSSE

package module
v0.0.0-...-681664d Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 19 Imported by: 0

README

NTLSSE - Nowhere to Leak: Forward and Backward Private Symmetric Searchable Encryption

A Go implementation of the NTLSSE (Nowhere To Leak Symmetric Searchable Encryption) protocol, based on the research paper:

📄 Nowhere to Leak: Forward and Backward Private Symmetric Searchable Encryption in the Multi-Client Setting (Extended Version)

📖 Overview

NTLSSE is a symmetric searchable encryption (SSE) scheme designed for multi-client environments that provides strong privacy guarantees. This implementation enables secure search over encrypted data while maintaining both forward and backward privacy, preventing information leakage even when the server is compromised or actively monitored.

Badges

Go Go Report Card

🚀 Installation

Prerequisites

  • Go 1.21 or higher
  • Git

📂 Project Structure

NTLSSE/
├── .github            # Github workflows
├── core/              # NTLSSE library packages
├── docs/              # Project documentation
├── protobuf/          # NTLSSE protocol setting
├── utils/             # utilties
├── .gitignore         # git ignore setting
├── go.mod             # Go module dependencies
├── go.sum             # Go module checksums
├── LICENSE            # MIT License
└── README.md          # Project information

📦 Usage

Basic Example

import "gitlab.com/nisec/applied-crypto/NTLSSE"

// Initialize NTLSSE
Documents := CreateRandomDocuments(100, 25, 75)
SSE := NewSSE()

// Setup encrypted database
SSE.Setup(Documents)

// Perform encrypted search
ids := SSE.Search(Documents[0].words[13])

// Update encrypted database
AddDocument := CreateRandomDocuments(1, 25, 75)
SSE.Add(AddDocument[0])

// Delete from encrypted database
SSE.Delete(AddDocument[0].identifier)

Support

Roadmap

Contributing

Authors and acknowledgment

  • The authors of the original NTLSSE paper for their groundbreaking research

License

Project status

📚 References

⚠️ Disclaimer

This is a research implementation. While based on cryptographically sound principles, it should be thoroughly reviewed and audited before use in production environments. The security guarantees hold under the assumptions stated in the original paper.

Documentation

Overview

A package that implements and exposes a test implementation of NTLSSE from the paper "Nowhere to Leak: Forward and Backward Private Symmetric Searchable Encryption in the Multi-Client Setting" (https://eprint.iacr.org/2021/903.pdf)

Index

Constants

View Source
const AddDel = "./AddDel"
View Source
const AllMapMessageFile = "./AllMap"
View Source
const DaAckFile = "./DaAck"
View Source
const FileKeyMessageFile = "./FileKey"

Communication files

View Source
const IndexMessageFile = "./Index"
View Source
const IndexToDaMessageFile = "./IndexToDa"
View Source
const IndexUpdate = "./IndexUp"
View Source
const QueryMessageFile = "./Query"
View Source
const QueryResultMessageFile = "./DaToClient"
View Source
const TAUpdate = "./TaInUp"
View Source
const TaQueryMessageFile = "./TaQuery"
View Source
const TokenKeyMessageFile = "./TokenKey"

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(key []byte, ciphertext []byte) []byte

decrypts a plaintext with the IV supplied at the beginning of the cipher

func AESDecryptInvertible

func AESDecryptInvertible(key []byte, ciphertext []byte) []byte

This is an decryption function with a hard coded IV to be used as an IPSF reverse

func AESEncrypt

func AESEncrypt(key []byte, plaintext []byte) []byte

Encrypts a plaintext with AES cbc and include the iv at the beginning

func AESEncryptIvSame

func AESEncryptIvSame(key []byte, plaintext []byte) []byte

This is an encryption function with a hard coded IV to be used as an IPSF

func CalculateAddress

func CalculateAddress(numOfFiles uint64, searchToken []byte) []byte

Calculates the address to be saved for a search token

func CalculateSearchToken

func CalculateSearchToken(aesKey []byte, hashedWord []byte, NoSearch uint64, encryptor IEncryptService) []byte

Calculates a search token for searching through SSE

func CalculateValue

func CalculateValue(fileKey []byte, Identifier string, NoFiles uint64, encryptor IEncryptService) []byte

func CleanFiles

func CleanFiles()

func GenerateKey

func GenerateKey() ([]byte, []byte)

Generates AES keys for SSE

func HashWord

func HashWord(word string) []byte

This hashes a singular word with a sha3 hash

func HashWords

func HashWords(words []string) [][]byte

A function to hash an array of strings with sha3

func PKCS5Pad

func PKCS5Pad(plaintext []byte) []byte

A modified PKCS5Pad function that Makes the length of a text be divisible by 16

func PKCS5Trim

func PKCS5Trim(plaintext []byte) []byte

A function to trim PKCS5 padding from a plain text

func SanitizeString

func SanitizeString(s string) string

A very basic function that sanitizes a string after it has been gotten from the command line or file

Types

type AESEncryptor

type AESEncryptor struct {
}

The default encryptor for tests. Can be overridden to use other types of functions

func (*AESEncryptor) FileDecrypt

func (AES *AESEncryptor) FileDecrypt(key []byte, ciphertext []byte) []byte

func (*AESEncryptor) FileEncrypt

func (AES *AESEncryptor) FileEncrypt(key []byte, plaintext []byte) []byte

func (*AESEncryptor) GenerateFileKey

func (AES *AESEncryptor) GenerateFileKey() []byte

func (*AESEncryptor) GenerateTokenKey

func (AES *AESEncryptor) GenerateTokenKey() []byte

func (*AESEncryptor) InvertibleDecrypt

func (AES *AESEncryptor) InvertibleDecrypt(key []byte, ciphertext []byte) []byte

func (*AESEncryptor) InvertibleEncrypt

func (AES *AESEncryptor) InvertibleEncrypt(key []byte, plaintext []byte) []byte

type Document

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

func CreateRandomDocuments

func CreateRandomDocuments(amount, minWords, MaxWords int) []Document

Generates random documents to use as test data without duplicate words in their content

type DocumentHandled

type DocumentHandled struct {
	HashedWords [][]byte
	NameCipher  []byte
}

func HandleDocument

func HandleDocument(d Document, fileKey []byte, encryptor IEncryptService) DocumentHandled

type IEncryptService

type IEncryptService interface {
	GenerateFileKey() []byte
	GenerateTokenKey() []byte
	FileEncrypt(key []byte, plaintext []byte) []byte
	FileDecrypt(key []byte, ciphertext []byte) []byte

	InvertibleEncrypt(key []byte, plaintext []byte) []byte
	InvertibleDecrypt(key []byte, ciphertext []byte) []byte
}

type LupMember

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

type NTLSSE

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

func NewSSE

func NewSSE() *NTLSSE

Defaults to AES encryptor and decryptor

func (*NTLSSE) Add

func (sse *NTLSSE) Add(doc Document) error

Runs the update algorithm from the NTL paper adding a document doc is the singular doc to be added to the csp

func (*NTLSSE) Delete

func (sse *NTLSSE) Delete(Identifier string)

Runs the first part of the update algorithm from the NTL paper. Rest of the delete algorithm is run when a search is started. Identifier is the identifier of the document to be deleted

func (*NTLSSE) Search

func (sse *NTLSSE) Search(keyword string) []string

runs the search part of the protocol from the NTL paper and returns the corresponding identifier

func (*NTLSSE) Setup

func (sse *NTLSSE) Setup(docs []Document) []error

Runs the setup algorithm from the NTL paper. docs are the documents that will be saved on the CSP

Directories

Path Synopsis
protobuf

Jump to

Keyboard shortcuts

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