cipher

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

README

pki

Helper to generate public/private keys, and encrypt/decrypt data by aes/rsa

Documentation

Overview

Package cipher is the legacy import path for core-owned cipher contracts.

New code should import the focused replacement package:

import "github.com/InsideGallery/core/pki/cryptor"

Compatibility: existing cipher contracts remain available for downstream consumers that still import pki. Do not add new cipher boundary helpers here; add them to pki/cryptor so call sites avoid a local name collision with crypto/cipher.

Index

Constants

This section is empty.

Variables

View Source
var ErrCipherNotSet = errors.New("cipher is not set")

ErrCipherNotSet reports a nil cipher dependency.

Functions

This section is empty.

Types

type Cipher

type Cipher interface {
	Encrypt([]byte) ([]byte, error)
	Decrypt([]byte) ([]byte, error)

	Kind() string
	ToBinary() ([]byte, error)
	FromBinary([]byte) (Cipher, error)
}

type Options added in v1.1.0

type Options struct {
	Kind string
}

Options identifies the cipher behavior requested by a consumer.

type Result added in v1.1.0

type Result struct {
	Kind string
	Data []byte
}

Result is the core-owned result shape for cipher operations.

func Decrypt added in v1.1.0

func Decrypt(ctx context.Context, c Cipher, ciphertext []byte) (Result, error)

Decrypt decrypts ciphertext through a Cipher without exposing implementation-specific result types.

func Encrypt added in v1.1.0

func Encrypt(ctx context.Context, c Cipher, plaintext []byte) (Result, error)

Encrypt encrypts plaintext through a Cipher without exposing implementation-specific result types.

Directories

Path Synopsis
Package aes is the legacy AES-GCM import path.
Package aes is the legacy AES-GCM import path.
Package aesgcm provides AES-GCM cipher helpers without colliding with crypto/aes.
Package aesgcm provides AES-GCM cipher helpers without colliding with crypto/aes.
Package cryptor defines core-owned cipher contracts and boundary helpers.
Package cryptor defines core-owned cipher contracts and boundary helpers.
Package mock_cipher is a generated GoMock package.
Package mock_cipher is a generated GoMock package.
Package rsa is the legacy RSA-OAEP import path.
Package rsa is the legacy RSA-OAEP import path.
Package rsaoaep provides RSA-OAEP cipher helpers without colliding with crypto/rsa.
Package rsaoaep provides RSA-OAEP cipher helpers without colliding with crypto/rsa.

Jump to

Keyboard shortcuts

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