sqlcrypt

package module
v0.0.0-...-0a3e098 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: ISC Imports: 9 Imported by: 0

README

sqlcrypt sqlcrypt GoDoc

The repository contains methods written in Go mapping the functionality of two built-in SQL Server functions: EncryptByPassPhrase and DecryptByPassPhrase. These functions are used to encrypt a given string of characters or decrypt the ciphertext.

The result returned by the EncryptByPassphrase function can be decrypted using the DecryptByPassPhrase function on SQL Server. Also the DecryptByPassphrase method can decrypt ciphertext generated by the EncryptByPassPhrase function on SQL Server.

The EncryptByPassphrase method creates a V2 encrypted message.

The DecryptByPassphrase function reads the version number from the ciphertext.

Msg Version Crypto SQL Server Versions Supported
V1 TripleDES / SHA1 SQL Server 2008 - SQL Server 2016 No
V2 AES256 / SHA256 SQL Server 2017 Yes

This does not support add_authenticator and authenticator arguments, which are optional in the SQL Server methods.

Reference

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptByPassphrase

func DecryptByPassphrase(passphrase string, cyphertext []byte) (string, error)

DecryptByPassphrase decrypts an encrypted byte slice in the SQL format, only only V2 format is supported. Authenticator is unsupported.

func EncryptByPassphrase

func EncryptByPassphrase(passphrase, plaintext string) ([]byte, error)

EncryptByPassphrase creates an encrypted byte slice matching the same format and as the SQL Server function. It creates a V2 format, without authenticator. It can be decrypted by SQL Server 2017 or later.

Types

This section is empty.

Jump to

Keyboard shortcuts

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