All Downloads are FREE. Search and download functionalities are using the official Maven repository.

AwsKmsEcdhKeyring_Compile.DecryptSingleEncryptedDataKey Maven / Gradle / Ivy

// Class DecryptSingleEncryptedDataKey
// Dafny class DecryptSingleEncryptedDataKey compiled into Java
package AwsKmsEcdhKeyring_Compile;

import software.amazon.cryptography.keystore.internaldafny.types.*;
import software.amazon.cryptography.materialproviders.internaldafny.types.*;
import AwsArnParsing_Compile.*;
import AwsKmsMrkMatchForDecrypt_Compile.*;
import AwsKmsUtils_Compile.*;
import KeyStoreErrorMessages_Compile.*;
import KmsArn_Compile.*;
import Structure_Compile.*;
import KMSKeystoreOperations_Compile.*;
import DDBKeystoreOperations_Compile.*;
import CreateKeys_Compile.*;
import CreateKeyStoreTable_Compile.*;
import GetKeys_Compile.*;
import AwsCryptographyKeyStoreOperations_Compile.*;
import software.amazon.cryptography.keystore.internaldafny.*;
import AlgorithmSuites_Compile.*;
import Materials_Compile.*;
import Keyring_Compile.*;
import MultiKeyring_Compile.*;
import AwsKmsMrkAreUnique_Compile.*;
import Constants_Compile.*;
import MaterialWrapping_Compile.*;
import CanonicalEncryptionContext_Compile.*;
import IntermediateKeyWrapping_Compile.*;
import EdkWrapping_Compile.*;
import ErrorMessages_Compile.*;
import AwsKmsKeyring_Compile.*;
import StrictMultiKeyring_Compile.*;
import AwsKmsDiscoveryKeyring_Compile.*;
import DiscoveryMultiKeyring_Compile.*;
import AwsKmsMrkDiscoveryKeyring_Compile.*;
import MrkAwareDiscoveryMultiKeyring_Compile.*;
import AwsKmsMrkKeyring_Compile.*;
import MrkAwareStrictMultiKeyring_Compile.*;
import LocalCMC_Compile.*;
import StormTracker_Compile.*;
import software.amazon.cryptography.internaldafny.StormTrackingCMC.*;
import CacheConstants_Compile.*;
import AwsKmsHierarchicalKeyring_Compile.*;
import AwsKmsRsaKeyring_Compile.*;
import EcdhEdkWrapping_Compile.*;
import RawECDHKeyring_Compile.*;

@SuppressWarnings({"unchecked", "deprecation"})
public class DecryptSingleEncryptedDataKey implements Actions_Compile.ActionWithResult, Actions_Compile.Action> {
  public DecryptSingleEncryptedDataKey() {
    this._materials = (software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials)null;
    this._cryptoPrimitives = null;
    this._recipientPublicKey = dafny.DafnySequence. empty(BoundedInts_Compile.uint8._typeDescriptor());
    this._keyAgreementScheme = software.amazon.cryptography.materialproviders.internaldafny.types.KmsEcdhStaticConfigurations.Default();
    this._client = null;
    this._curveSpec = software.amazon.cryptography.primitives.internaldafny.types.ECDHCurveSpec.Default();
    this._grantTokens = dafny.DafnySequence.> empty(software.amazon.cryptography.services.kms.internaldafny.types.GrantTokenType._typeDescriptor());
  }
  public void __ctor(software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials materials, software.amazon.cryptography.primitives.internaldafny.AtomicPrimitivesClient cryptoPrimitives, dafny.DafnySequence recipientPublicKey, software.amazon.cryptography.services.kms.internaldafny.types.IKMSClient client, dafny.DafnySequence> grantTokens, software.amazon.cryptography.materialproviders.internaldafny.types.KmsEcdhStaticConfigurations keyAgreementScheme, software.amazon.cryptography.primitives.internaldafny.types.ECDHCurveSpec curveSpec)
  {
    (this)._materials = materials;
    (this)._cryptoPrimitives = cryptoPrimitives;
    (this)._recipientPublicKey = recipientPublicKey;
    (this)._keyAgreementScheme = keyAgreementScheme;
    (this)._client = client;
    (this)._curveSpec = curveSpec;
    (this)._grantTokens = grantTokens;
  }
  public Wrappers_Compile.Result Invoke(software.amazon.cryptography.materialproviders.internaldafny.types.EncryptedDataKey edk)
  {
    Wrappers_Compile.Result res = (Wrappers_Compile.Result)null;
    Wrappers_Compile.Outcome _0_valueOrError0 = Wrappers_Compile.Outcome.Default(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    _0_valueOrError0 = Wrappers_Compile.__default.Need(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), UTF8.__default.ValidUTF8Seq((edk).dtor_keyProviderId()), software.amazon.cryptography.materialproviders.internaldafny.types.Error.create_AwsCryptographicMaterialProvidersException(dafny.DafnySequence.asString("Received invalid EDK provider id for AWS KMS ECDH Keyring")));
    if ((_0_valueOrError0).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_0_valueOrError0).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    software.amazon.cryptography.materialproviders.internaldafny.types.AlgorithmSuiteInfo _1_suite;
    _1_suite = ((this).materials()).dtor_algorithmSuite();
    dafny.DafnySequence _2_keyProviderId;
    _2_keyProviderId = (edk).dtor_keyProviderId();
    dafny.DafnySequence _3_providerInfo;
    _3_providerInfo = (edk).dtor_keyProviderInfo();
    dafny.DafnySequence _4_ciphertext;
    _4_ciphertext = (edk).dtor_ciphertext();
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _5_valueOrError1 = Wrappers_Compile.Result., software.amazon.cryptography.materialproviders.internaldafny.types.Error>Default(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.DafnySequence. empty(BoundedInts_Compile.uint8._typeDescriptor()));
    _5_valueOrError1 = EdkWrapping_Compile.__default.GetProviderWrappedMaterial(_4_ciphertext, _1_suite);
    if ((_5_valueOrError1).IsFailure(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_5_valueOrError1).PropagateFailure(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    dafny.DafnySequence _6_providerWrappedMaterial;
    _6_providerWrappedMaterial = (_5_valueOrError1).Extract(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    Wrappers_Compile.Outcome _7_valueOrError2 = Wrappers_Compile.Outcome.Default(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    _7_valueOrError2 = Wrappers_Compile.__default.Need(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), ((java.math.BigInteger.valueOf((_3_providerInfo).length())).compareTo(dafny.Helpers.unsignedToBigInteger(Constants_Compile.__default.ECDH__PROVIDER__INFO__521__LEN())) <= 0) && (RawECDHKeyring_Compile.__default.ValidProviderInfoLength(_3_providerInfo)), __default.E(dafny.DafnySequence.asString("EDK ProviderInfo longer than expected")));
    if ((_7_valueOrError2).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_7_valueOrError2).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    byte _8_keyringVersion;
    _8_keyringVersion = ((byte)(java.lang.Object)((_3_providerInfo).select(dafny.Helpers.toInt((java.math.BigInteger.ZERO)))));
    Wrappers_Compile.Outcome _9_valueOrError3 = Wrappers_Compile.Outcome.Default(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    _9_valueOrError3 = Wrappers_Compile.__default.Need(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), (dafny.DafnySequence. of(_8_keyringVersion)).equals(__default.AWS__KMS__ECDH__KEYRING__VERSION()), __default.E(dafny.DafnySequence.asString("Incorrect Keyring version found in provider info.")));
    if ((_9_valueOrError3).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_9_valueOrError3).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    java.math.BigInteger _10_recipientPublicKeyLength = java.math.BigInteger.ZERO;
    _10_recipientPublicKeyLength = dafny.Helpers.unsignedToBigInteger(StandardLibrary_mUInt_Compile.__default.SeqToUInt32((_3_providerInfo).subsequence(Constants_Compile.__default.ECDH__PROVIDER__INFO__RPL__INDEX(), Constants_Compile.__default.ECDH__PROVIDER__INFO__RPK__INDEX())));
    java.math.BigInteger _11_recipientPublicKeyLengthIndex = java.math.BigInteger.ZERO;
    _11_recipientPublicKeyLengthIndex = (dafny.Helpers.unsignedToBigInteger(Constants_Compile.__default.ECDH__PROVIDER__INFO__RPK__INDEX())).add(_10_recipientPublicKeyLength);
    java.math.BigInteger _12_senderPublicKeyIndex = java.math.BigInteger.ZERO;
    _12_senderPublicKeyIndex = (_11_recipientPublicKeyLengthIndex).add(Constants_Compile.__default.ECDH__PROVIDER__INFO__PUBLIC__KEY__LEN());
    Wrappers_Compile.Outcome _13_valueOrError4 = Wrappers_Compile.Outcome.Default(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    _13_valueOrError4 = Wrappers_Compile.__default.Need(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), ((_11_recipientPublicKeyLengthIndex).add(java.math.BigInteger.valueOf(4L))).compareTo(java.math.BigInteger.valueOf((_3_providerInfo).length())) < 0, __default.E(dafny.DafnySequence.asString("Key Provider Info Serialization Error. Serialized length less than expected.")));
    if ((_13_valueOrError4).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_13_valueOrError4).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    dafny.DafnySequence _14_providerInfoRecipientPublicKey;
    _14_providerInfoRecipientPublicKey = (_3_providerInfo).subsequence(Constants_Compile.__default.ECDH__PROVIDER__INFO__RPK__INDEX(), dafny.Helpers.toInt((_11_recipientPublicKeyLengthIndex)));
    dafny.DafnySequence _15_providerInfoSenderPublicKey;
    _15_providerInfoSenderPublicKey = (_3_providerInfo).drop(_12_senderPublicKeyIndex);
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _16_valueOrError5 = Wrappers_Compile.Result., software.amazon.cryptography.materialproviders.internaldafny.types.Error>Default(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.DafnySequence. empty(BoundedInts_Compile.uint8._typeDescriptor()));
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _out0;
    _out0 = RawECDHKeyring_Compile.__default.DecompressPublicKey(_15_providerInfoSenderPublicKey, (this).curveSpec(), (this).cryptoPrimitives());
    _16_valueOrError5 = _out0;
    if ((_16_valueOrError5).IsFailure(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_16_valueOrError5).PropagateFailure(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    dafny.DafnySequence _17_senderPublicKey;
    _17_senderPublicKey = (_16_valueOrError5).Extract(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _18_valueOrError6 = Wrappers_Compile.Result., software.amazon.cryptography.materialproviders.internaldafny.types.Error>Default(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.DafnySequence. empty(BoundedInts_Compile.uint8._typeDescriptor()));
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _out1;
    _out1 = RawECDHKeyring_Compile.__default.DecompressPublicKey(_14_providerInfoRecipientPublicKey, (this).curveSpec(), (this).cryptoPrimitives());
    _18_valueOrError6 = _out1;
    if ((_18_valueOrError6).IsFailure(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_18_valueOrError6).PropagateFailure(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    dafny.DafnySequence _19_recipientPublicKey;
    _19_recipientPublicKey = (_18_valueOrError6).Extract(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    Wrappers_Compile.Result _20_valueOrError7 = Wrappers_Compile.Result.Default(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), false);
    Wrappers_Compile.Result _out2;
    _out2 = RawECDHKeyring_Compile.__default.ValidatePublicKey((this).cryptoPrimitives(), (this).curveSpec(), _17_senderPublicKey);
    _20_valueOrError7 = _out2;
    if ((_20_valueOrError7).IsFailure(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_20_valueOrError7).PropagateFailure(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    boolean _21___v0;
    _21___v0 = (_20_valueOrError7).Extract(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    Wrappers_Compile.Result _22_valueOrError8 = Wrappers_Compile.Result.Default(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), false);
    Wrappers_Compile.Result _out3;
    _out3 = RawECDHKeyring_Compile.__default.ValidatePublicKey((this).cryptoPrimitives(), (this).curveSpec(), _19_recipientPublicKey);
    _22_valueOrError8 = _out3;
    if ((_22_valueOrError8).IsFailure(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_22_valueOrError8).PropagateFailure(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    boolean _23___v1;
    _23___v1 = (_22_valueOrError8).Extract(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    Wrappers_Compile.Outcome _24_valueOrError9 = Wrappers_Compile.Outcome.Default(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    _24_valueOrError9 = Wrappers_Compile.__default.Need(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), (software.amazon.cryptography.services.kms.internaldafny.types.__default.IsValid__PublicKeyType(_17_senderPublicKey)) && (software.amazon.cryptography.services.kms.internaldafny.types.__default.IsValid__PublicKeyType((this).recipientPublicKey())), __default.E(dafny.DafnySequence.asString("Received serialized sender public key of incorrect length")));
    if ((_24_valueOrError9).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_24_valueOrError9).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    dafny.DafnySequence _25_sharedSecretPublicKey = dafny.DafnySequence. empty(BoundedInts_Compile.uint8._typeDescriptor());
    dafny.DafnySequence _26_sharedSecretKmsKeyId = dafny.DafnySequence. empty(dafny.TypeDescriptor.CHAR);
    software.amazon.cryptography.materialproviders.internaldafny.types.KmsEcdhStaticConfigurations _source0 = (this).keyAgreementScheme();
    if (_source0.is_KmsPublicKeyDiscovery()) {
      software.amazon.cryptography.materialproviders.internaldafny.types.KmsPublicKeyDiscoveryInput _27___mcc_h0 = ((software.amazon.cryptography.materialproviders.internaldafny.types.KmsEcdhStaticConfigurations_KmsPublicKeyDiscovery)_source0)._KmsPublicKeyDiscovery;
      software.amazon.cryptography.materialproviders.internaldafny.types.KmsPublicKeyDiscoveryInput _28_kmsPublicKeyDiscovery = _27___mcc_h0;
      {
        Wrappers_Compile.Result _29_valueOrError10 = Wrappers_Compile.Result.Default(dafny.Tuple0._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.Tuple0.Default());
        _29_valueOrError10 = AwsKmsUtils_Compile.__default.ValidateKmsKeyId((_28_kmsPublicKeyDiscovery).dtor_recipientKmsIdentifier());
        if ((_29_valueOrError10).IsFailure(dafny.Tuple0._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
          res = (_29_valueOrError10).PropagateFailure(dafny.Tuple0._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
          return res;
        }
        dafny.Tuple0 _30___v2;
        _30___v2 = (_29_valueOrError10).Extract(dafny.Tuple0._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
        _25_sharedSecretPublicKey = _17_senderPublicKey;
        _26_sharedSecretKmsKeyId = (_28_kmsPublicKeyDiscovery).dtor_recipientKmsIdentifier();
      }
    } else {
      software.amazon.cryptography.materialproviders.internaldafny.types.KmsPrivateKeyToStaticPublicKeyInput _31___mcc_h1 = ((software.amazon.cryptography.materialproviders.internaldafny.types.KmsEcdhStaticConfigurations_KmsPrivateKeyToStaticPublicKey)_source0)._KmsPrivateKeyToStaticPublicKey;
      software.amazon.cryptography.materialproviders.internaldafny.types.KmsPrivateKeyToStaticPublicKeyInput _32_kmsPrivateKeyToStaticPublicKey = _31___mcc_h1;
      {
        Wrappers_Compile.Result _33_valueOrError11 = Wrappers_Compile.Result.Default(dafny.Tuple0._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.Tuple0.Default());
        _33_valueOrError11 = AwsKmsUtils_Compile.__default.ValidateKmsKeyId((_32_kmsPrivateKeyToStaticPublicKey).dtor_senderKmsIdentifier());
        if ((_33_valueOrError11).IsFailure(dafny.Tuple0._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
          res = (_33_valueOrError11).PropagateFailure(dafny.Tuple0._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
          return res;
        }
        dafny.Tuple0 _34___v3;
        _34___v3 = (_33_valueOrError11).Extract(dafny.Tuple0._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
        _26_sharedSecretKmsKeyId = (_32_kmsPrivateKeyToStaticPublicKey).dtor_senderKmsIdentifier();
        if (((_32_kmsPrivateKeyToStaticPublicKey).dtor_recipientPublicKey()).equals(_19_recipientPublicKey)) {
          _25_sharedSecretPublicKey = _19_recipientPublicKey;
        } else {
          _25_sharedSecretPublicKey = _17_senderPublicKey;
        }
      }
    }
    Wrappers_Compile.Outcome _35_valueOrError12 = Wrappers_Compile.Outcome.Default(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    _35_valueOrError12 = Wrappers_Compile.__default.Need(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), software.amazon.cryptography.services.kms.internaldafny.types.__default.IsValid__PublicKeyType(_25_sharedSecretPublicKey), __default.E(dafny.DafnySequence.asString("Received Recipient Public Key of incorrect expected length")));
    if ((_35_valueOrError12).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_35_valueOrError12).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _36_valueOrError13 = Wrappers_Compile.Result., software.amazon.cryptography.materialproviders.internaldafny.types.Error>Default(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.DafnySequence. empty(BoundedInts_Compile.uint8._typeDescriptor()));
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _out4;
    _out4 = __default.DeriveSharedSecret((this).client(), _26_sharedSecretKmsKeyId, _25_sharedSecretPublicKey, (this).grantTokens());
    _36_valueOrError13 = _out4;
    if ((_36_valueOrError13).IsFailure(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_36_valueOrError13).PropagateFailure(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    dafny.DafnySequence _37_sharedSecret;
    _37_sharedSecret = (_36_valueOrError13).Extract(dafny.DafnySequence._typeDescriptor(BoundedInts_Compile.uint8._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    EcdhEdkWrapping_Compile.EcdhUnwrap _38_ecdhUnwrap;
    EcdhEdkWrapping_Compile.EcdhUnwrap _nw0 = new EcdhEdkWrapping_Compile.EcdhUnwrap();
    _nw0.__ctor(_15_providerInfoSenderPublicKey, _14_providerInfoRecipientPublicKey, _37_sharedSecret, __default.AWS__KMS__ECDH__KEYRING__VERSION(), (this).curveSpec(), (this).cryptoPrimitives());
    _38_ecdhUnwrap = _nw0;
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _39_unwrapOutputRes;
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _out5;
    _out5 = EdkWrapping_Compile.__default.UnwrapEdkMaterial(EcdhEdkWrapping_Compile.EcdhUnwrapInfo._typeDescriptor(), (edk).dtor_ciphertext(), (this).materials(), _38_ecdhUnwrap);
    _39_unwrapOutputRes = _out5;
    Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _40_valueOrError14 = Wrappers_Compile.Result., software.amazon.cryptography.materialproviders.internaldafny.types.Error>Default(EdkWrapping_Compile.UnwrapEdkMaterialOutput._typeDescriptor(EcdhEdkWrapping_Compile.EcdhUnwrapInfo._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), EdkWrapping_Compile.UnwrapEdkMaterialOutput.Default(EcdhEdkWrapping_Compile.EcdhUnwrapInfo._typeDescriptor(), EcdhEdkWrapping_Compile.EcdhUnwrapInfo.Default()));
    _40_valueOrError14 = _39_unwrapOutputRes;
    if ((_40_valueOrError14).IsFailure(EdkWrapping_Compile.UnwrapEdkMaterialOutput._typeDescriptor(EcdhEdkWrapping_Compile.EcdhUnwrapInfo._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_40_valueOrError14).PropagateFailure(EdkWrapping_Compile.UnwrapEdkMaterialOutput._typeDescriptor(EcdhEdkWrapping_Compile.EcdhUnwrapInfo._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    EdkWrapping_Compile.UnwrapEdkMaterialOutput _41_unwrapOutput;
    _41_unwrapOutput = (_40_valueOrError14).Extract(EdkWrapping_Compile.UnwrapEdkMaterialOutput._typeDescriptor(EcdhEdkWrapping_Compile.EcdhUnwrapInfo._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    Wrappers_Compile.Result _42_valueOrError15 = (Wrappers_Compile.Result)null;
    _42_valueOrError15 = Materials_Compile.__default.DecryptionMaterialsAddDataKey((this).materials(), (_41_unwrapOutput).dtor_plaintextDataKey(), (_41_unwrapOutput).dtor_symmetricSigningKey());
    if ((_42_valueOrError15).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
      res = (_42_valueOrError15).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor());
      return res;
    }
    software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials _43_result;
    _43_result = (_42_valueOrError15).Extract(software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
    res = Wrappers_Compile.Result.create_Success(software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), _43_result);
    return res;
  }
  public software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials _materials;
  public software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials materials()
  {
    return this._materials;
  }
  public software.amazon.cryptography.primitives.internaldafny.AtomicPrimitivesClient _cryptoPrimitives;
  public software.amazon.cryptography.primitives.internaldafny.AtomicPrimitivesClient cryptoPrimitives()
  {
    return this._cryptoPrimitives;
  }
  public dafny.DafnySequence _recipientPublicKey;
  public dafny.DafnySequence recipientPublicKey()
  {
    return this._recipientPublicKey;
  }
  public software.amazon.cryptography.materialproviders.internaldafny.types.KmsEcdhStaticConfigurations _keyAgreementScheme;
  public software.amazon.cryptography.materialproviders.internaldafny.types.KmsEcdhStaticConfigurations keyAgreementScheme()
  {
    return this._keyAgreementScheme;
  }
  public software.amazon.cryptography.services.kms.internaldafny.types.IKMSClient _client;
  public software.amazon.cryptography.services.kms.internaldafny.types.IKMSClient client()
  {
    return this._client;
  }
  public software.amazon.cryptography.primitives.internaldafny.types.ECDHCurveSpec _curveSpec;
  public software.amazon.cryptography.primitives.internaldafny.types.ECDHCurveSpec curveSpec()
  {
    return this._curveSpec;
  }
  public dafny.DafnySequence> _grantTokens;
  public dafny.DafnySequence> grantTokens()
  {
    return this._grantTokens;
  }
  private static final dafny.TypeDescriptor _TYPE = dafny.TypeDescriptor.referenceWithInitializer(DecryptSingleEncryptedDataKey.class, () -> (DecryptSingleEncryptedDataKey) null);
  public static dafny.TypeDescriptor _typeDescriptor() {
    return (dafny.TypeDescriptor) (dafny.TypeDescriptor) _TYPE;
  }
  @Override
  public java.lang.String toString() {
    return "AwsKmsEcdhKeyring.DecryptSingleEncryptedDataKey";
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy