Skip to content

yandex-cloud/kms-clients-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yandex.Cloud KMS Clients

Clients for Yandex.Clouds KMS.

Tink KMS Client for Yandex.Cloud

GoDoc

Installation

go get github.com/yandex-cloud/kms-clients-go/yckmstink

Examples

The following code encrypts plaintext "Hello, KMS!" with keyID and then decrypts it.

func EncryptAndDecrypt(token string, keyID string) {
    sdk, err := ycsdk.Build(ctx, ycsdk.Config{
        Credentials: ycsdk.OAuthToken(token),
    })
    if err != nil {
        log.Fatal(err)
    }
    
    a := yckmstink.NewYCAEAD(keyID, sdk)
    ciphertext, err := a.Encrypt([]byte("Hello, KMS!"), []byte("aad"))
    if err != nil {
        log.Fatal(err)
    }
    plaintext, err := a.Decrypt(ciphertext, []byte("aad"))
    if err != nil {
        log.Fatal(err)
    }
    // Prints "Hello, KMS!"
    log.Print(string(plaintext))
}

You can find more examples are in the examples directory.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages