Documentation
¶
Index ¶
- Constants
- func CheckFileFolderExists(folderFilePath string) bool
- func ExecCommand(name string, stdinInput string, args ...string) (string, error)
- func GetDataFromFile(certPath string) (string, error)
- func GetPrivateKey(privateKeyPath string) (string, error)
- func OpensslCheck() error
- func ReadDataFromFile(filePath string) (string, error)
- func WriteDataToFile(filePath, data string) error
Constants ¶
View Source
const ( ContractCliName = "contract-cli" ContractCliShortDescription = "Contract CLI: A CLI utility tool for Hyper Protect" ContractCliLongDescription = `` /* 137-byte string literal not displayed */ FileInFlagName = "in" FileOutFlagName = "out" DataFormatFlagName = "format" DataFormatDefault = "json" DataFormatJson = "json" DataFormatYaml = "yaml" DataFormatText = "text" DataFormatFlagDescription = "Format in which the data needs to STDOUT or saved in file" PrivateKeyFlagName = "priv" PrivateKeyFlagDescription = "Path to private key" CertFlagName = "cert" CertFlagDescription = "Path to encryption certificate" OsVersionFlagName = "os" OsVersionFlagDescription = "Hyper Protect OS version (hpvs/hpcr-rhvs)" VersionFlagName = "version" // Decrypt Attestation Records DecryptAttestParamName = "decrypt-attestation" DecryptAttestParamShortDescription = "Decrypt encrypted attestation records" DecryptAttestParamLongDescription = `Decrypt encrypted attestation record generated by HPVS/HPCR-RHVS under /var/hyperprotect/se-checksums.txt.enc` DecryptAttestFileInDefaultPath = "build/se-checksums.txt.enc" DecryptAttestFileInDescription = "Path to file that stores encrypted attestation records" DecryptAttestFlagDescription = "Path to save the decrypted attestation records" // Get latest HPVS Image ID ImageParamName = "image" ImageParamShortDescription = "Get latest HPCR Image ID from IBM Cloud Image list" ImageParamLongDescription = `Get latest HPCR image ID in IBM Cloud from IBM images JSON output from IBM Cloud API or CLI` IbmCloudJsonInputDescription = "Path to Terraform output or CLI or API result of image list" HpcrVersionFlagDescription = "Get IBM Cloud Image details of specified HPCR version" HpcrImageFlagDescription = "Path to store HPCR image details" // Download Encryption certificates DownloadCertParamName = "download-certificate" DownloadCertParamShortDescription = "Download encryption certificate" DownloadCertParamLongDescription = `Download encryption certificate for HPCR from IBM Hyper Protect Repository` EncryptionCertVersionFlagDescription = "Versions of Encryption Certificates to download, Seperated by coma(,)" EncryptionCertsFlagDescription = "Path to save the encryption certificates" // Get Encryption Certificate GetCertParamName = "get-certificate" GetCertParamShortDescription = "Get version specific encryption certificate from download-certificate JSON ouput" GetCertParamLongDescription = `Get version specific encryption certificate from JSON output of download-certificate` GetCertFileInFlagDescription = "Path to the saved encryption certificates JSON" GetCertVersionFlagDescription = "Encryption certificate version to select" GetCertFileOutFlagDescription = "Path to store the selected encryption certificate" // Base64 Base64ParamName = "base64" Base64ParamShortDescription = "Generate base64 of input" Base64ParamLongDescription = `Generate base64 of input text` Base64InputFlagDescription = "Input data that needs to be converted to string" Base64InputFormatFlagDescription = "Format of input data (options: text/json)" Base64OutputPathFlagDescription = "Path to store Base64 output" // Encrypt String EncryptStrParamName = "encrypt-string" EncryptStrParamShortDescription = "Encrypt string as per Hyper Protect format" EncryptStrParamLongDescription = `Encrypt string in format hyper-protect-basic.<encrypted-password>.<encrypted-string>` EncryptStrInputFlagDescription = "Data to encrypt" EncryptStrFormatFlagDescription = "The input string format (supported: text/json)" EncryptStrOutputFlagDescription = "Path to store the encrypted data" // Base64 tar Base64TgzParamName = "base64-tgz" Base64TgzParamShortDescription = "Generate base64 tar.tgz of docker-compose.yaml or pods.yaml" Base64TgzParamLongDescription = `Generate base64 tar.tgz of folder containing docker-compose.yaml or pods.yaml` Base64TgzInputFlagDescription = "Path to folder containing docker-compose.yaml or pods.yaml" Base64TgzOutputFormatFlagName = "output" Base64TgzOutputFormatFlagDescription = "output format (unencrypted or encrypted)" Base64TgzOutputFormatUnencrypted = "plain" Base64TgzOutputFormatencrypted = "encrypt" Base64TgzOutputFormatDefault = Base64TgzOutputFormatUnencrypted Base64TgzOutputPathDescription = "Path to store the encrypted or encrypted base64 tar tgz" // Validate contract ValidateContractParamName = "validate-contract" ValidateContractParamShortDescription = "Validate unencrypted contract" ValidateContractParamLongDescription = `Validate unencrypted contract with schema` ValidateContractInputFlagDescription = "Path to Hyper Protect encrypted contract contract" // Signed and Encrypted Contract (With contract expiry) EncryptParamName = "encrypt" EncryptParamShortDescription = "Generate signed and encrypted contract" EncryptParamLongDescription = `Generate signed and encrypted contract` EncryptInputFlagDescription = "Path to contract" EncryptOutputFlagDescription = "Path to store signed and encrypted contract" EncryptContractExpiryFlagName = "contract-expiry" EncryptContractExpiryFlagDefault = false EncryptContractExpiryFlagDescription = "Boolean flag to enable contract expiry" EncryptCaCertFlagName = "cacert" EncryptCaCertFlagDescription = "Path to CA Certificate" EncryptCaKeyFlagName = "cakey" EncryptCaKeyFlagDescription = "Path to CA Key" EncryptCsrDataFlagName = "csrParam" EncryptCsrDataFlagDescription = "Path to CSR details JSON file" EncryptCsrFlagName = "csr" EncryptCsrFlagDescription = "Path to CSR file" EncryptExpiryDaysFlagName = "expiry" EncryptExpiryDaysFlagDescription = "Expiry of the contract in number of days" )
Variables ¶
This section is empty.
Functions ¶
func CheckFileFolderExists ¶
CheckFileFolderExists - function to check if file or folder exists
func ExecCommand ¶
ExecCommand - function to run os commands
func GetDataFromFile ¶ added in v1.1.0
GetDataFromFile - function to get data from file
func GetPrivateKey ¶
GetPrivateKey - function to get private key from path or generate a new private key
func ReadDataFromFile ¶
ReadDataFromFile - function to read data from file
func WriteDataToFile ¶
WriteDataToFile - function to write data to file (create file if doesn't exists)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.