
AwsKmsMrkDiscoveryKeyring_Compile.AwsKmsMrkDiscoveryKeyring Maven / Gradle / Ivy
// Class AwsKmsMrkDiscoveryKeyring
// Dafny class AwsKmsMrkDiscoveryKeyring compiled into Java
package AwsKmsMrkDiscoveryKeyring_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.*;
@SuppressWarnings({"unchecked", "deprecation"})
public class AwsKmsMrkDiscoveryKeyring implements Keyring_Compile.VerifiableInterface, software.amazon.cryptography.materialproviders.internaldafny.types.IKeyring {
public AwsKmsMrkDiscoveryKeyring() {
this._client = null;
this._region = dafny.DafnySequence. empty(dafny.TypeDescriptor.CHAR);
this._discoveryFilter = Wrappers_Compile.Option.Default(software.amazon.cryptography.materialproviders.internaldafny.types.DiscoveryFilter._typeDescriptor());
this._grantTokens = dafny.DafnySequence.> empty(software.amazon.cryptography.services.kms.internaldafny.types.GrantTokenType._typeDescriptor());
}
public Wrappers_Compile.Result OnDecrypt(software.amazon.cryptography.materialproviders.internaldafny.types.OnDecryptInput input)
{
Wrappers_Compile.Result _out4;
_out4 = software.amazon.cryptography.materialproviders.internaldafny.types._Companion_IKeyring.OnDecrypt(this, input);
return _out4;
}
public Wrappers_Compile.Result OnEncrypt(software.amazon.cryptography.materialproviders.internaldafny.types.OnEncryptInput input)
{
Wrappers_Compile.Result _out4;
_out4 = software.amazon.cryptography.materialproviders.internaldafny.types._Companion_IKeyring.OnEncrypt(this, input);
return _out4;
}
public void __ctor(software.amazon.cryptography.services.kms.internaldafny.types.IKMSClient client, dafny.DafnySequence extends Character> region, Wrappers_Compile.Option discoveryFilter, dafny.DafnySequence extends dafny.DafnySequence extends Character>> grantTokens)
{
(this)._client = client;
(this)._region = region;
(this)._discoveryFilter = discoveryFilter;
(this)._grantTokens = grantTokens;
}
public Wrappers_Compile.Result OnEncrypt_k(software.amazon.cryptography.materialproviders.internaldafny.types.OnEncryptInput input)
{
Wrappers_Compile.Result output = (Wrappers_Compile.Result)null;
output = Wrappers_Compile.Result.create_Failure(software.amazon.cryptography.materialproviders.internaldafny.types.OnEncryptOutput._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error.create_AwsCryptographicMaterialProvidersException(dafny.DafnySequence.asString("Encryption is not supported with a Discovery Keyring.")));
return output;
}
public Wrappers_Compile.Result OnDecrypt_k(software.amazon.cryptography.materialproviders.internaldafny.types.OnDecryptInput input)
{
Wrappers_Compile.Result output = (Wrappers_Compile.Result)null;
software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials _0_materials;
_0_materials = (input).dtor_materials();
dafny.DafnySequence extends software.amazon.cryptography.materialproviders.internaldafny.types.EncryptedDataKey> _1_encryptedDataKeys;
_1_encryptedDataKeys = (input).dtor_encryptedDataKeys();
software.amazon.cryptography.materialproviders.internaldafny.types.AlgorithmSuiteInfo _2_suite;
_2_suite = ((input).dtor_materials()).dtor_algorithmSuite();
Wrappers_Compile.Outcome _3_valueOrError0 = Wrappers_Compile.Outcome.Default(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
_3_valueOrError0 = Wrappers_Compile.__default.Need(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), Materials_Compile.__default.DecryptionMaterialsWithoutPlaintextDataKey(_0_materials), software.amazon.cryptography.materialproviders.internaldafny.types.Error.create_AwsCryptographicMaterialProvidersException(dafny.DafnySequence.asString("Keyring received decryption materials that already contain a plaintext data key.")));
if ((_3_valueOrError0).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
output = (_3_valueOrError0).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.OnDecryptOutput._typeDescriptor());
return output;
}
AwsKmsEncryptedDataKeyFilterTransform _4_edkFilterTransform;
AwsKmsEncryptedDataKeyFilterTransform _nw0 = new AwsKmsEncryptedDataKeyFilterTransform();
_nw0.__ctor((this).region(), (this).discoveryFilter());
_4_edkFilterTransform = _nw0;
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(Constants_Compile.AwsKmsEdkHelper._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.DafnySequence. empty(Constants_Compile.AwsKmsEdkHelper._typeDescriptor()));
Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _out0;
_out0 = Actions_Compile.__default.DeterministicFlatMapWithResult(software.amazon.cryptography.materialproviders.internaldafny.types.EncryptedDataKey._typeDescriptor(), Constants_Compile.AwsKmsEdkHelper._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), _4_edkFilterTransform, _1_encryptedDataKeys);
_5_valueOrError1 = _out0;
if ((_5_valueOrError1).IsFailure(dafny.DafnySequence._typeDescriptor(Constants_Compile.AwsKmsEdkHelper._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
output = (_5_valueOrError1).PropagateFailure(dafny.DafnySequence._typeDescriptor(Constants_Compile.AwsKmsEdkHelper._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.OnDecryptOutput._typeDescriptor());
return output;
}
dafny.DafnySequence extends Constants_Compile.AwsKmsEdkHelper> _6_edksToAttempt;
_6_edksToAttempt = (_5_valueOrError1).Extract(dafny.DafnySequence._typeDescriptor(Constants_Compile.AwsKmsEdkHelper._typeDescriptor()), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
if ((java.math.BigInteger.valueOf((_6_edksToAttempt).length())).signum() == 0) {
Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _7_valueOrError2 = Wrappers_Compile.Result., software.amazon.cryptography.materialproviders.internaldafny.types.Error>Default(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.DafnySequence. empty(dafny.TypeDescriptor.CHAR));
_7_valueOrError2 = ErrorMessages_Compile.__default.IncorrectDataKeys((input).dtor_encryptedDataKeys(), ((input).dtor_materials()).dtor_algorithmSuite(), dafny.DafnySequence.asString(""));
if ((_7_valueOrError2).IsFailure(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
output = (_7_valueOrError2).PropagateFailure(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.OnDecryptOutput._typeDescriptor());
return output;
}
dafny.DafnySequence extends Character> _8_errorMessage;
_8_errorMessage = (_7_valueOrError2).Extract(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
output = Wrappers_Compile.Result.create_Failure(software.amazon.cryptography.materialproviders.internaldafny.types.OnDecryptOutput._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error.create_AwsCryptographicMaterialProvidersException(_8_errorMessage));
return output;
}
AwsKmsEncryptedDataKeyDecryptor _9_decryptAction;
AwsKmsEncryptedDataKeyDecryptor _nw1 = new AwsKmsEncryptedDataKeyDecryptor();
_nw1.__ctor(_0_materials, (this).client(), (this).region(), (this).grantTokens());
_9_decryptAction = _nw1;
Wrappers_Compile.Result> _10_outcome;
Wrappers_Compile.Result> _out1;
_out1 = Actions_Compile.__default.ReduceToSuccess(Constants_Compile.AwsKmsEdkHelper._typeDescriptor(), Materials_Compile.SealedDecryptionMaterials._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), _9_decryptAction, _6_edksToAttempt);
_10_outcome = _out1;
Wrappers_Compile.Result> _source0 = _10_outcome;
if (_source0.is_Success()) {
software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials _11___mcc_h0 = ((Wrappers_Compile.Result_Success>)_source0)._value;
software.amazon.cryptography.materialproviders.internaldafny.types.DecryptionMaterials _12_mat = _11___mcc_h0;
output = Wrappers_Compile.Result.create_Success(software.amazon.cryptography.materialproviders.internaldafny.types.OnDecryptOutput._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.OnDecryptOutput.create(_12_mat));
} else {
dafny.DafnySequence extends software.amazon.cryptography.materialproviders.internaldafny.types.Error> _13___mcc_h1 = ((Wrappers_Compile.Result_Failure>)_source0)._error;
dafny.DafnySequence extends software.amazon.cryptography.materialproviders.internaldafny.types.Error> _14_errors = _13___mcc_h1;
output = Wrappers_Compile.Result.create_Failure(software.amazon.cryptography.materialproviders.internaldafny.types.OnDecryptOutput._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error.create_CollectionOfErrors(_14_errors, dafny.DafnySequence.asString("No Configured KMS Key was able to decrypt the Data Key. The list of encountered Exceptions is available via `list`.")));
}
return output;
}
public software.amazon.cryptography.services.kms.internaldafny.types.IKMSClient _client;
public software.amazon.cryptography.services.kms.internaldafny.types.IKMSClient client()
{
return this._client;
}
public dafny.DafnySequence extends Character> _region;
public dafny.DafnySequence extends Character> region()
{
return this._region;
}
public Wrappers_Compile.Option _discoveryFilter;
public Wrappers_Compile.Option discoveryFilter()
{
return this._discoveryFilter;
}
public dafny.DafnySequence extends dafny.DafnySequence extends Character>> _grantTokens;
public dafny.DafnySequence extends dafny.DafnySequence extends Character>> grantTokens()
{
return this._grantTokens;
}
private static final dafny.TypeDescriptor _TYPE = dafny.TypeDescriptor.referenceWithInitializer(AwsKmsMrkDiscoveryKeyring.class, () -> (AwsKmsMrkDiscoveryKeyring) null);
public static dafny.TypeDescriptor _typeDescriptor() {
return (dafny.TypeDescriptor) (dafny.TypeDescriptor>) _TYPE;
}
@Override
public java.lang.String toString() {
return "AwsKmsMrkDiscoveryKeyring.AwsKmsMrkDiscoveryKeyring";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy