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 ¶
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 ¶
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. |