
AwsKmsDiscoveryKeyring_Compile.AwsKmsEncryptedDataKeyFilter Maven / Gradle / Ivy
// Class AwsKmsEncryptedDataKeyFilter
// Dafny class AwsKmsEncryptedDataKeyFilter compiled into Java
package AwsKmsDiscoveryKeyring_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.*;
@SuppressWarnings({"unchecked", "deprecation"})
public class AwsKmsEncryptedDataKeyFilter implements Actions_Compile.DeterministicActionWithResult, Actions_Compile.DeterministicAction> {
public AwsKmsEncryptedDataKeyFilter() {
this._discoveryFilter = Wrappers_Compile.Option.Default(software.amazon.cryptography.materialproviders.internaldafny.types.DiscoveryFilter._typeDescriptor());
}
public void __ctor(Wrappers_Compile.Option discoveryFilter)
{
(this)._discoveryFilter = discoveryFilter;
}
public Wrappers_Compile.Result Invoke(software.amazon.cryptography.materialproviders.internaldafny.types.EncryptedDataKey edk)
{
Wrappers_Compile.Result output = Wrappers_Compile.Result.Default(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), false);
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_keyProviderInfo()), software.amazon.cryptography.materialproviders.internaldafny.types.Error.create_AwsCryptographicMaterialProvidersException(dafny.DafnySequence.asString("Invalid AWS KMS encoding, provider info is not UTF8.")));
if ((_0_valueOrError0).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
output = (_0_valueOrError0).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.TypeDescriptor.BOOLEAN);
return output;
}
Wrappers_Compile.Result, software.amazon.cryptography.materialproviders.internaldafny.types.Error> _1_valueOrError1 = 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));
_1_valueOrError1 = (UTF8.__default.Decode((edk).dtor_keyProviderInfo())).MapFailure(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), AwsKmsUtils_Compile.__default::WrapStringToError);
if ((_1_valueOrError1).IsFailure(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
output = (_1_valueOrError1).PropagateFailure(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.TypeDescriptor.BOOLEAN);
return output;
}
dafny.DafnySequence extends Character> _2_keyId;
_2_keyId = (_1_valueOrError1).Extract(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
Wrappers_Compile.Result _3_valueOrError2 = (Wrappers_Compile.Result)null;
_3_valueOrError2 = (AwsArnParsing_Compile.__default.ParseAwsKmsArn(_2_keyId)).MapFailure(AwsArnParsing_Compile.AwsKmsArn._typeDescriptor(), dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), AwsKmsUtils_Compile.__default::WrapStringToError);
if ((_3_valueOrError2).IsFailure(AwsArnParsing_Compile.AwsKmsArn._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
output = (_3_valueOrError2).PropagateFailure(AwsArnParsing_Compile.AwsKmsArn._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.TypeDescriptor.BOOLEAN);
return output;
}
AwsArnParsing_Compile.AwsArn _4_arn;
_4_arn = (_3_valueOrError2).Extract(AwsArnParsing_Compile.AwsKmsArn._typeDescriptor(), software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
Wrappers_Compile.Outcome _5_valueOrError3 = Wrappers_Compile.Outcome.Default(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor());
_5_valueOrError3 = Wrappers_Compile.__default.Need(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), (((_4_arn).dtor_resource()).dtor_resourceType()).equals(dafny.DafnySequence.asString("key")), software.amazon.cryptography.materialproviders.internaldafny.types.Error.create_AwsCryptographicMaterialProvidersException(dafny.DafnySequence.asString("Only AWS KMS Keys supported")));
if ((_5_valueOrError3).IsFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor())) {
output = (_5_valueOrError3).PropagateFailure(software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), dafny.TypeDescriptor.BOOLEAN);
return output;
}
if (!((edk).dtor_keyProviderId()).equals(Constants_Compile.__default.PROVIDER__ID())) {
output = Wrappers_Compile.Result.create_Success(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), false);
return output;
}
if (!(__default.DiscoveryMatch(_4_arn, (this).discoveryFilter()))) {
output = Wrappers_Compile.Result.create_Success(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), false);
return output;
}
output = Wrappers_Compile.Result.create_Success(dafny.TypeDescriptor.BOOLEAN, software.amazon.cryptography.materialproviders.internaldafny.types.Error._typeDescriptor(), true);
return output;
}
public Wrappers_Compile.Option _discoveryFilter;
public Wrappers_Compile.Option discoveryFilter()
{
return this._discoveryFilter;
}
private static final dafny.TypeDescriptor _TYPE = dafny.TypeDescriptor.referenceWithInitializer(AwsKmsEncryptedDataKeyFilter.class, () -> (AwsKmsEncryptedDataKeyFilter) null);
public static dafny.TypeDescriptor _typeDescriptor() {
return (dafny.TypeDescriptor) (dafny.TypeDescriptor>) _TYPE;
}
@Override
public java.lang.String toString() {
return "AwsKmsDiscoveryKeyring.AwsKmsEncryptedDataKeyFilter";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy