Skip to content

Commit

Permalink
chore: update documentation as per latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashwat-K committed May 26, 2024
1 parent e09c8e2 commit 7070b1a
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


## Introduction

The library has been developed to simply the process for provisioning HPVS on both IBM Cloud and On Prem.
For more details regarding HPVS, refer [Confidential computing with LinuxONE](https://cloud.ibm.com/docs/vpc?topic=vpc-about-se)

Expand All @@ -13,6 +12,7 @@ For more details regarding HPVS, refer [Confidential computing with LinuxONE](ht
### HpcrGetAttestationRecords()
This function decrypts encrypted attestation records.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/attestation"

Expand All @@ -32,6 +32,7 @@ func main() {
### HpcrDownloadEncryptionCertificates()
This function downloads HPCR encryption certificates from IBM Cloud.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/certificate"

Expand All @@ -50,6 +51,7 @@ func main() {
### HpcrGetEncryptionCertificateFromJson()
This function returns encryption certificate and version from HpcrDownloadEncryptionCertificates() output.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/certificate"

Expand All @@ -70,11 +72,12 @@ func main() {
### HpcrText()
This function generates Base64 for given string.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/contract"

func main() {
base64, sha256, err := HpcrText(sampleStringData)
base64, inputSha256, outputSha256, err := HpcrText(sampleStringData)
}
```

Expand All @@ -84,16 +87,18 @@ func main() {
#### Output(s)
1. Base64 of input
2. Checksum of input
3. Checksum of output


### HpcrTextEncrypted()
This function encrypts text and formats text as per `hyper-protect-basic.<encoded-encrypted-password>.<encoded-encrypted-data>`.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/contract"

func main() {
encryptedText, sha256, err := HpcrTextEncrypted(sampleStringData, encryptionCertificate)
encryptedText, inputSha256, outputSha256, err := HpcrTextEncrypted(sampleStringData, encryptionCertificate)
}
```

Expand All @@ -104,16 +109,18 @@ func main() {
#### Output(s)
1. Encrypted text
2. Checksum of input
3. Checksum of output


### HpcrJson()
This function generates Base64 of JSON input

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/contract"

func main() {
base64, sha256, err := HpcrJson(sampleStringJson)
base64, inputSha256, outputSha256, err := HpcrJson(sampleStringJson)
}
```

Expand All @@ -123,16 +130,18 @@ func main() {
#### Output(s)
1. Base64 of input
2. Checksum of input
3. Checksum of output


### HpcrJsonEncrypted()
This function generates encrypts JSON and formats text as per `hyper-protect-basic.<encoded-encrypted-password>.<encoded-encrypted-data>`.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/contract"

func main() {
encryptedJson, sha256, err := HpcrJsonEncrypted(sampleStringJson, encryptionCertificate)
encryptedJson, inputSha256, outputSha256, err := HpcrJsonEncrypted(sampleStringJson, encryptionCertificate)
}
```

Expand All @@ -143,16 +152,18 @@ func main() {
#### Output(s)
1. Encrypted text
2. Checksum of input
3. Checksum of output


### HpcrTgz()
This function generates base64 of TGZ that contains files under the given folder

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/contract"

func main() {
encodedTgz, err := HpcrTgz(composePath)
encodedTgz, inputSha256, outputSha256, err := HpcrTgz(composePath)
}
```

Expand All @@ -161,16 +172,19 @@ func main() {

#### Output(s)
1. Base64 of TGZ where TGZ is contents of given folder
2. Checksum of imput
3. Checksum of output


### HpcrTgzEncrypted()
This function first generates base64 of TGZ that contains files under the given folder and then encrypts the data as per `hyper-protect-basic.<encoded-encrypted-password>.<encoded-encrypted-data>`.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/contract"

func main() {
encodedTgz, err := HpcrTgzEncrypted(composePath, encryptionCertificate)
encodedTgz, inputSha256, outputSha256, err := HpcrTgzEncrypted(composePath, encryptionCertificate)
}
```

Expand All @@ -179,16 +193,19 @@ func main() {

#### Output(s)
1. encrypted base64 of TGZ where TGZ is contents of given folder
2. Checksum of input
3. Checksum of output


### HpcrContractSignedEncrypted()
This function generates a signed and encrypted contract with format `hyper-protect-basic.<encoded-encrypted-password>.<encoded-encrypted-data>`.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/contract"

func main() {
signedEncryptedContract, err := HpcrContractSignedEncrypted(contract, encryptionCertificate, privateKey)
signedEncryptedContract, inputSha256, outputSha256, err := HpcrContractSignedEncrypted(contract, encryptionCertificate, privateKey)
}
```

Expand All @@ -199,11 +216,14 @@ func main() {

#### Output(s)
1. Signed and encrypted contract
2. Checksum of input
3. Checksum of output


### HpcrContractSignedEncryptedContractExpiry()
This function generates a signed and encrypted contract with contract expiry enabled. The output will be of the format `hyper-protect-basic.<encoded-encrypted-password>.<encoded-encrypted-data>`.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/contract"

Expand All @@ -218,11 +238,11 @@ func usingCsrParams() {
"mail": "[email protected]",
}

signedEncryptedCEContract, err := HpcrContractSignedEncryptedContractExpiry(contract, encryptionCertificate, privateKey, caCert, caKey, string(csrParams), "", sampleContractExpiryDays)
signedEncryptedCEContract, inputSha256, outputSha256, err := HpcrContractSignedEncryptedContractExpiry(contract, encryptionCertificate, privateKey, caCert, caKey, string(csrParams), "", sampleContractExpiryDays)
}

func usingCsrPem() {
signedEncryptedCEContract, err := HpcrContractSignedEncryptedContractExpiry(contract, encryptionCertificate, privateKey, caCert, caKey, "", csr, sampleContractExpiryDays)
signedEncryptedCEContract, inputSha256, outputSha256, err := HpcrContractSignedEncryptedContractExpiry(contract, encryptionCertificate, privateKey, caCert, caKey, "", csr, sampleContractExpiryDays)
}
```

Expand Down Expand Up @@ -252,11 +272,14 @@ The CSR parameters should be of the format:-

#### Output(s)
1. Signed and encrypted contract
2. Checksum of input
3. Checksum of output


### HpcrSelectImage()
This function selects the latest HPCR image details from image list out from IBM Cloud images API.

### Example
```go
import "github.com/Sashwat-K/lib-hpcr/image"

Expand Down

0 comments on commit 7070b1a

Please sign in to comment.