cryptor

package
v1.2.1 Latest Latest
Warning

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

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

README

pki/cryptor

Import path: github.com/InsideGallery/core/pki/cryptor

cryptor is the preferred package for the core cipher contract and operation boundary helpers. It delegates to the legacy pki path for compatibility while providing a clearer import path for new code.

Main API

  • Cipher is the shared interface implemented by core cipher packages.
  • Options carries a requested cipher Kind.
  • Result returns a cipher Kind and operation Data.
  • Encrypt(ctx, cipher, plaintext) checks for nil cipher dependencies, respects a canceled context before work starts, and returns encrypted data.
  • Decrypt(ctx, cipher, ciphertext) applies the same checks before decryption.
  • ErrCipherNotSet reports a nil cipher argument.

Usage

package example

import (
	"context"

	"github.com/InsideGallery/core/pki/aesgcm"
	"github.com/InsideGallery/core/pki/cryptor"
)

func encrypt(ctx context.Context, plaintext []byte) (cryptor.Result, error) {
	cipher, err := aesgcm.New(aesgcm.KeySize32)
	if err != nil {
		return cryptor.Result{}, err
	}

	return cryptor.Encrypt(ctx, cipher, plaintext)
}

Compatibility Notes

This package mirrors the legacy github.com/InsideGallery/core/pki API. The legacy path remains available, but new call sites should use pki/cryptor.

Documentation

Overview

Package cryptor defines core-owned cipher contracts and boundary helpers.

New code should import this package instead of the legacy pki path:

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

Compatibility: github.com/InsideGallery/core/pki remains available for existing consumers. Prefer Options, Result, Cipher, Encrypt, and Decrypt from this package so cipher contracts stay behind a focused import path.

Index

Constants

This section is empty.

Variables

View Source
var ErrCipherNotSet = legacy.ErrCipherNotSet

ErrCipherNotSet reports a nil cipher dependency.

Functions

This section is empty.

Types

type Cipher

type Cipher = legacy.Cipher

Cipher is the contract implemented by core-owned cipher implementations.

type Options

type Options = legacy.Options

Options identifies the cipher behavior requested by a consumer.

type Result

type Result = legacy.Result

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

func Decrypt

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

Decrypt decrypts ciphertext through a Cipher.

func Encrypt

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

Encrypt encrypts plaintext through a Cipher.

Jump to

Keyboard shortcuts

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