Skip to content

About

The Golang SDK to interact with your OVHcloud KMS services.

Topics

Resources

Code of conduct

Contributing

Stars

9 stars

Watchers

13 watching

Forks

Repository files navigation

okms-sdk-go

Go Reference license test

The Golang SDK to interact with your OVHcloud KMS services.

NOTE: THIS PROJECT IS CURRENTLY UNDER DEVELOPMENT AND SUBJECT TO BREAKING CHANGES.

How to use

Add it to your project by running

go get github.com/ovh/okms-sdk-go@latest

Then you can connect to your KMS service

cert, err := tls.LoadX509KeyPair(os.Getenv("OKMS_CLIENT_CERT_FILE"), os.Getenv("OKMS_CLIENT_KEY_FILE"))
if err != nil {
    panic(err)
}
httpClient := http.Client{
    Transport: &http.Transport{TLSClientConfig: &tls.Config{
        Certificates: []tls.Certificate{cert},
        MinVersion:   tls.VersionTLS12,
    }},
}

okmsIdString := os.Getenv("OKMS_ID")
okmsId, err := uuid.Parse(okmsIdString)
if err != nil {
    panic(err)
}

kmsClient, err := okms.NewRestAPIClientWithHttp("https://eu-west-rbx.okms.ovh.net", &httpClient)
if err != nil {
    panic(err)
}

// Then start using the kmsClient
// Create a new AES 256 key
respAes, err := okmsClient.GenerateSymmetricKey(ctx, okmsId, types.N256, "AES key example", "", []types.CryptographicUsages{types.Encrypt, types.Decrypt, types.WrapKey, types.UnwrapKey})
if err != nil {
    panic(err)
}
fmt.Println("AES KEY:", respAes.Id)

See examples for more.

If you don't have any KMS service yet, you can follow the OVHcloud KMS quick start guide.

Features

Current SDK allows you to manipulate and consume keys through the KMS REST API. Implemented operations are

  • Keys and Key Pairs lifecycle:
    • Create keys and key pairs
    • Import keys and key pairs
    • Import wrapped keys and key pairs (unwrapped by the KMS using a transport key)
    • Activate and Deactivate keys and key pairs
    • Update keys and key pairs
    • Destroy keys and key pairs
    • Update keys and key pairs metadata
    • List keys and key pairs
    • Export key pair's public keys
    • Export keys and key pairs in wrapped form (encrypted under a transport key)
    • Read keys and key pairs metadata
  • Symmetric Key operations
    • Encrypt / Decrypt data
    • Generate data keys
    • Decrypt data keys
  • Assymetric Key Pair operations
    • Sign / Verify data

About

The Golang SDK to interact with your OVHcloud KMS services.

Topics

Resources

Code of conduct

Contributing

Stars

9 stars

Watchers

13 watching

Forks

Releases

Used by

Contributors

Languages