Skip to content

ovh/okms-sdk-go

Repository files navigation

okms-sdk-go

Go Reference license test Go Report Card

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("KMS_CLIENT_CERT_FILE"), os.Getenv("KMS_CLIENT_KEY_FILE"))
if err != nil {
    panic(err)
}
httpClient := http.Client{
    Transport: &http.Transport{TLSClientConfig: &tls.Config{
        Certificates: []tls.Certificate{cert},
        MinVersion:   tls.VersionTLS12,
    }},
}
kmsClient, err := okms.NewRestAPIClientWithHttp("https://eu-west-rbx.okms.ovh.net", &httpClient)
if err != nil {
    panic(err)
}

// Then start using the kmsClient

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
    • 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
    • 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