Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.kms.getCiphertext
Explore with Pulumi AI
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const key = new alicloud.kms.Key("key", {
description: "example key",
isEnabled: true,
});
const encrypted = alicloud.kms.getCiphertextOutput({
keyId: key.id,
plaintext: "example",
});
import pulumi
import pulumi_alicloud as alicloud
key = alicloud.kms.Key("key",
description="example key",
is_enabled=True)
encrypted = alicloud.kms.get_ciphertext_output(key_id=key.id,
plaintext="example")
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/kms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
key, err := kms.NewKey(ctx, "key", &kms.KeyArgs{
Description: pulumi.String("example key"),
IsEnabled: pulumi.Bool(true),
})
if err != nil {
return err
}
_ = kms.LookupCiphertextOutput(ctx, kms.GetCiphertextOutputArgs{
KeyId: key.ID(),
Plaintext: pulumi.String("example"),
}, nil)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var key = new AliCloud.Kms.Key("key", new()
{
Description = "example key",
IsEnabled = true,
});
var encrypted = AliCloud.Kms.GetCiphertext.Invoke(new()
{
KeyId = key.Id,
Plaintext = "example",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.kms.Key;
import com.pulumi.alicloud.kms.KeyArgs;
import com.pulumi.alicloud.kms.KmsFunctions;
import com.pulumi.alicloud.kms.inputs.GetCiphertextArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var key = new Key("key", KeyArgs.builder()
.description("example key")
.isEnabled(true)
.build());
final var encrypted = KmsFunctions.getCiphertext(GetCiphertextArgs.builder()
.keyId(key.id())
.plaintext("example")
.build());
}
}
resources:
key:
type: alicloud:kms:Key
properties:
description: example key
isEnabled: true
variables:
encrypted:
fn::invoke:
Function: alicloud:kms:getCiphertext
Arguments:
keyId: ${key.id}
plaintext: example
Using getCiphertext
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getCiphertext(args: GetCiphertextArgs, opts?: InvokeOptions): Promise<GetCiphertextResult>
function getCiphertextOutput(args: GetCiphertextOutputArgs, opts?: InvokeOptions): Output<GetCiphertextResult>
def get_ciphertext(encryption_context: Optional[Mapping[str, str]] = None,
key_id: Optional[str] = None,
plaintext: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetCiphertextResult
def get_ciphertext_output(encryption_context: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
key_id: Optional[pulumi.Input[str]] = None,
plaintext: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetCiphertextResult]
func LookupCiphertext(ctx *Context, args *LookupCiphertextArgs, opts ...InvokeOption) (*LookupCiphertextResult, error)
func LookupCiphertextOutput(ctx *Context, args *LookupCiphertextOutputArgs, opts ...InvokeOption) LookupCiphertextResultOutput
> Note: This function is named LookupCiphertext
in the Go SDK.
public static class GetCiphertext
{
public static Task<GetCiphertextResult> InvokeAsync(GetCiphertextArgs args, InvokeOptions? opts = null)
public static Output<GetCiphertextResult> Invoke(GetCiphertextInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetCiphertextResult> getCiphertext(GetCiphertextArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:kms/getCiphertext:getCiphertext
arguments:
# arguments dictionary
The following arguments are supported:
- Key
Id string - The globally unique ID of the CMK.
- Plaintext string
- The plaintext to be encrypted which must be encoded in Base64.
- Encryption
Context Dictionary<string, string> - The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
- Key
Id string - The globally unique ID of the CMK.
- Plaintext string
- The plaintext to be encrypted which must be encoded in Base64.
- Encryption
Context map[string]string - The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
- key
Id String - The globally unique ID of the CMK.
- plaintext String
- The plaintext to be encrypted which must be encoded in Base64.
- encryption
Context Map<String,String> - The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
- key
Id string - The globally unique ID of the CMK.
- plaintext string
- The plaintext to be encrypted which must be encoded in Base64.
- encryption
Context {[key: string]: string} - The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
- key_
id str - The globally unique ID of the CMK.
- plaintext str
- The plaintext to be encrypted which must be encoded in Base64.
- encryption_
context Mapping[str, str] - The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
- key
Id String - The globally unique ID of the CMK.
- plaintext String
- The plaintext to be encrypted which must be encoded in Base64.
- encryption
Context Map<String> - The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
getCiphertext Result
The following output properties are available:
- Ciphertext
Blob string - The ciphertext of the data key encrypted with the primary CMK version.
- Id string
- The provider-assigned unique ID for this managed resource.
- Key
Id string - Plaintext string
- Encryption
Context Dictionary<string, string>
- Ciphertext
Blob string - The ciphertext of the data key encrypted with the primary CMK version.
- Id string
- The provider-assigned unique ID for this managed resource.
- Key
Id string - Plaintext string
- Encryption
Context map[string]string
- ciphertext
Blob String - The ciphertext of the data key encrypted with the primary CMK version.
- id String
- The provider-assigned unique ID for this managed resource.
- key
Id String - plaintext String
- encryption
Context Map<String,String>
- ciphertext
Blob string - The ciphertext of the data key encrypted with the primary CMK version.
- id string
- The provider-assigned unique ID for this managed resource.
- key
Id string - plaintext string
- encryption
Context {[key: string]: string}
- ciphertext_
blob str - The ciphertext of the data key encrypted with the primary CMK version.
- id str
- The provider-assigned unique ID for this managed resource.
- key_
id str - plaintext str
- encryption_
context Mapping[str, str]
- ciphertext
Blob String - The ciphertext of the data key encrypted with the primary CMK version.
- id String
- The provider-assigned unique ID for this managed resource.
- key
Id String - plaintext String
- encryption
Context Map<String>
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.