encryption

package module
v1.173.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

  • Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
  • SPDX-License-Identifier: Apache-2.0

Package encryption defines utilities with regards to cryptography.

Index

Constants

View Source
const KeySize = 32

Variables

This section is empty.

Functions

func DecryptWithKeyPair

func DecryptWithKeyPair(keys IKeyPair, base64EncodedEncryptedMessage string) (decryptedMessage string, err error)

DecryptWithKeyPair decrypts small base64 encoded messages

func EncryptWithPublicKey

func EncryptWithPublicKey(base64EncodedPublicKey string, message string) (encryptedBase64Message string, err error)

EncryptWithPublicKey encrypts small messages using a 32-byte public key (See https://libsodium.gitbook.io/doc/public-key_cryptography/sealed_boxes)

Types

type IKeyPair

type IKeyPair interface {
	fmt.Stringer
	fmt.GoStringer
	json.Marshaler
	// GetPublicKey returns the public key (base64 encoded)
	GetPublicKey() string
	// GetPrivateKey returns the private key (base64 encoded)
	GetPrivateKey() string
}

IKeyPair defines an asymmetric key pair for cryptography.

func GenerateKeyPair

func GenerateKeyPair() (pair IKeyPair, err error)

GenerateKeyPair generates a asymmetric key pair suitable for use with encryption utilities. Works with [NaCl box](https://nacl.cr.yp.to/box.html.)

Directories

Path Synopsis
aesrsa module
testhelpers module
* Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors.
* Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors.

Jump to

Keyboard shortcuts

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