1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. kms
  5. getCiphertext
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.kms.getCiphertext

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

    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:

    KeyId string
    The globally unique ID of the CMK.
    Plaintext string
    The plaintext to be encrypted which must be encoded in Base64.
    EncryptionContext 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.
    KeyId string
    The globally unique ID of the CMK.
    Plaintext string
    The plaintext to be encrypted which must be encoded in Base64.
    EncryptionContext 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.
    keyId String
    The globally unique ID of the CMK.
    plaintext String
    The plaintext to be encrypted which must be encoded in Base64.
    encryptionContext 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.
    keyId string
    The globally unique ID of the CMK.
    plaintext string
    The plaintext to be encrypted which must be encoded in Base64.
    encryptionContext {[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.
    keyId String
    The globally unique ID of the CMK.
    plaintext String
    The plaintext to be encrypted which must be encoded in Base64.
    encryptionContext 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:

    CiphertextBlob string
    The ciphertext of the data key encrypted with the primary CMK version.
    Id string
    The provider-assigned unique ID for this managed resource.
    KeyId string
    Plaintext string
    EncryptionContext Dictionary<string, string>
    CiphertextBlob string
    The ciphertext of the data key encrypted with the primary CMK version.
    Id string
    The provider-assigned unique ID for this managed resource.
    KeyId string
    Plaintext string
    EncryptionContext map[string]string
    ciphertextBlob String
    The ciphertext of the data key encrypted with the primary CMK version.
    id String
    The provider-assigned unique ID for this managed resource.
    keyId String
    plaintext String
    encryptionContext Map<String,String>
    ciphertextBlob string
    The ciphertext of the data key encrypted with the primary CMK version.
    id string
    The provider-assigned unique ID for this managed resource.
    keyId string
    plaintext string
    encryptionContext {[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]
    ciphertextBlob String
    The ciphertext of the data key encrypted with the primary CMK version.
    id String
    The provider-assigned unique ID for this managed resource.
    keyId String
    plaintext String
    encryptionContext 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.
    alicloud logo
    Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi