AWS SDK for PHP 3.x
  • Namespace
  • Class
Did this page help you? SUBMIT FEEDBACK!

Namespaces

  • Aws
    • AccessAnalyzer
      • Exception
    • Account
      • Exception
    • Acm
      • Exception
    • ACMPCA
      • Exception
    • AlexaForBusiness
      • Exception
    • Amplify
      • Exception
    • AmplifyBackend
      • Exception
    • AmplifyUIBuilder
      • Exception
    • Api
      • ErrorParser
      • Parser
        • Exception
      • Serializer
    • ApiGateway
      • Exception
    • ApiGatewayManagementApi
      • Exception
    • ApiGatewayV2
      • Exception
    • AppConfig
      • Exception
    • AppConfigData
      • Exception
    • Appflow
      • Exception
    • AppIntegrationsService
      • Exception
    • ApplicationAutoScaling
      • Exception
    • ApplicationCostProfiler
      • Exception
    • ApplicationDiscoveryService
      • Exception
    • ApplicationInsights
      • Exception
    • AppMesh
      • Exception
    • AppRegistry
      • Exception
    • AppRunner
      • Exception
    • Appstream
      • Exception
    • AppSync
      • Exception
    • ARCZonalShift
      • Exception
    • Arn
      • Exception
    • Athena
      • Exception
    • AuditManager
      • Exception
    • AugmentedAIRuntime
      • Exception
    • AutoScaling
      • Exception
    • AutoScalingPlans
      • Exception
    • Backup
      • Exception
    • BackupGateway
      • Exception
    • BackupStorage
      • Exception
    • Batch
      • Exception
    • BillingConductor
      • Exception
    • Braket
      • Exception
    • Budgets
      • Exception
    • Chime
      • Exception
    • ChimeSDKIdentity
      • Exception
    • ChimeSDKMediaPipelines
      • Exception
    • ChimeSDKMeetings
      • Exception
    • ChimeSDKMessaging
      • Exception
    • ChimeSDKVoice
      • Exception
    • CleanRooms
      • Exception
    • ClientSideMonitoring
      • Exception
    • Cloud9
      • Exception
    • CloudControlApi
      • Exception
    • CloudDirectory
      • Exception
    • CloudFormation
      • Exception
    • CloudFront
      • Exception
    • CloudHsm
      • Exception
    • CloudHSMV2
      • Exception
    • CloudSearch
      • Exception
    • CloudSearchDomain
      • Exception
    • CloudTrail
      • Exception
    • CloudTrailData
      • Exception
    • CloudWatch
      • Exception
    • CloudWatchEvents
      • Exception
    • CloudWatchEvidently
      • Exception
    • CloudWatchLogs
      • Exception
    • CloudWatchRUM
      • Exception
    • CodeArtifact
      • Exception
    • CodeBuild
      • Exception
    • CodeCatalyst
      • Exception
    • CodeCommit
      • Exception
    • CodeDeploy
      • Exception
    • CodeGuruProfiler
      • Exception
    • CodeGuruReviewer
      • Exception
    • CodePipeline
      • Exception
    • CodeStar
      • Exception
    • CodeStarconnections
      • Exception
    • CodeStarNotifications
      • Exception
    • CognitoIdentity
      • Exception
    • CognitoIdentityProvider
      • Exception
    • CognitoSync
      • Exception
    • Comprehend
      • Exception
    • ComprehendMedical
      • Exception
    • ComputeOptimizer
      • Exception
    • ConfigService
      • Exception
    • Connect
      • Exception
    • ConnectCampaignService
      • Exception
    • ConnectCases
      • Exception
    • ConnectContactLens
      • Exception
    • ConnectParticipant
      • Exception
    • ConnectWisdomService
      • Exception
    • ControlTower
      • Exception
    • CostandUsageReportService
      • Exception
    • CostExplorer
      • Exception
    • Credentials
    • Crypto
      • Cipher
      • Polyfill
    • CustomerProfiles
      • Exception
    • DatabaseMigrationService
      • Exception
    • DataExchange
      • Exception
    • DataPipeline
      • Exception
    • DataSync
      • Exception
    • DAX
      • Exception
    • DefaultsMode
      • Exception
    • Detective
      • Exception
    • DeviceFarm
      • Exception
    • DevOpsGuru
      • Exception
    • DirectConnect
      • Exception
    • DirectoryService
      • Exception
    • DLM
      • Exception
    • DocDB
      • Exception
    • DocDBElastic
      • Exception
    • drs
      • Exception
    • DynamoDb
      • Exception
    • DynamoDbStreams
      • Exception
    • EBS
      • Exception
    • Ec2
      • Exception
    • EC2InstanceConnect
      • Exception
    • Ecr
      • Exception
    • ECRPublic
      • Exception
    • Ecs
      • Exception
    • Efs
      • Exception
    • EKS
      • Exception
    • ElastiCache
      • Exception
    • ElasticBeanstalk
      • Exception
    • ElasticInference
      • Exception
    • ElasticLoadBalancing
      • Exception
    • ElasticLoadBalancingV2
      • Exception
    • ElasticsearchService
      • Exception
    • ElasticTranscoder
      • Exception
    • Emr
      • Exception
    • EMRContainers
      • Exception
    • EMRServerless
      • Exception
    • Endpoint
      • UseDualstackEndpoint
        • Exception
      • UseFipsEndpoint
        • Exception
    • EndpointDiscovery
      • Exception
    • EndpointV2
      • Rule
      • Ruleset
    • EventBridge
      • Exception
    • Exception
    • finspace
      • Exception
    • FinSpaceData
      • Exception
    • Firehose
      • Exception
    • FIS
      • Exception
    • FMS
      • Exception
    • ForecastQueryService
      • Exception
    • ForecastService
      • Exception
    • FraudDetector
      • Exception
    • FSx
      • Exception
    • GameLift
      • Exception
    • GameSparks
      • Exception
    • Glacier
      • Exception
    • GlobalAccelerator
      • Exception
    • Glue
      • Exception
    • GlueDataBrew
      • Exception
    • Greengrass
      • Exception
    • GreengrassV2
      • Exception
    • GroundStation
      • Exception
    • GuardDuty
      • Exception
    • Handler
      • GuzzleV5
      • GuzzleV6
    • Health
      • Exception
    • HealthLake
      • Exception
    • Honeycode
      • Exception
    • Iam
      • Exception
    • IdentityStore
      • Exception
    • imagebuilder
      • Exception
    • ImportExport
      • Exception
    • Inspector
      • Exception
    • Inspector2
      • Exception
    • InternetMonitor
      • Exception
    • Iot
      • Exception
    • IoT1ClickDevicesService
      • Exception
    • IoT1ClickProjects
      • Exception
    • IoTAnalytics
      • Exception
    • IotDataPlane
      • Exception
    • IoTDeviceAdvisor
      • Exception
    • IoTEvents
      • Exception
    • IoTEventsData
      • Exception
    • IoTFleetHub
      • Exception
    • IoTFleetWise
      • Exception
    • IoTJobsDataPlane
      • Exception
    • IoTRoboRunner
      • Exception
    • IoTSecureTunneling
      • Exception
    • IoTSiteWise
      • Exception
    • IoTThingsGraph
      • Exception
    • IoTTwinMaker
      • Exception
    • IoTWireless
      • Exception
    • IVS
      • Exception
    • ivschat
      • Exception
    • IVSRealTime
      • Exception
    • Kafka
      • Exception
    • KafkaConnect
      • Exception
    • kendra
      • Exception
    • KendraRanking
      • Exception
    • Keyspaces
      • Exception
    • Kinesis
      • Exception
    • KinesisAnalytics
      • Exception
    • KinesisAnalyticsV2
      • Exception
    • KinesisVideo
      • Exception
    • KinesisVideoArchivedMedia
      • Exception
    • KinesisVideoMedia
      • Exception
    • KinesisVideoSignalingChannels
      • Exception
    • KinesisVideoWebRTCStorage
      • Exception
    • Kms
      • Exception
    • LakeFormation
      • Exception
    • Lambda
      • Exception
    • LexModelBuildingService
      • Exception
    • LexModelsV2
      • Exception
    • LexRuntimeService
      • Exception
    • LexRuntimeV2
      • Exception
    • LicenseManager
      • Exception
    • LicenseManagerLinuxSubscriptions
      • Exception
    • LicenseManagerUserSubscriptions
      • Exception
    • Lightsail
      • Exception
    • LocationService
      • Exception
    • LookoutEquipment
      • Exception
    • LookoutforVision
      • Exception
    • LookoutMetrics
      • Exception
    • MachineLearning
      • Exception
    • Macie
      • Exception
    • Macie2
      • Exception
    • MainframeModernization
      • Exception
    • ManagedBlockchain
      • Exception
    • ManagedGrafana
      • Exception
    • MarketplaceCatalog
      • Exception
    • MarketplaceCommerceAnalytics
      • Exception
    • MarketplaceEntitlementService
      • Exception
    • MarketplaceMetering
      • Exception
    • MediaConnect
      • Exception
    • MediaConvert
      • Exception
    • MediaLive
      • Exception
    • MediaPackage
      • Exception
    • MediaPackageVod
      • Exception
    • MediaStore
      • Exception
    • MediaStoreData
      • Exception
    • MediaTailor
      • Exception
    • MemoryDB
      • Exception
    • mgn
      • Exception
    • MigrationHub
      • Exception
    • MigrationHubConfig
      • Exception
    • MigrationHubOrchestrator
      • Exception
    • MigrationHubRefactorSpaces
      • Exception
    • MigrationHubStrategyRecommendations
      • Exception
    • Mobile
      • Exception
    • MQ
      • Exception
    • MTurk
      • Exception
    • Multipart
    • MWAA
      • Exception
    • Neptune
      • Exception
    • NetworkFirewall
      • Exception
    • NetworkManager
      • Exception
    • NimbleStudio
      • Exception
    • OAM
      • Exception
    • Omics
      • Exception
    • OpenSearchServerless
      • Exception
    • OpenSearchService
      • Exception
    • OpsWorks
      • Exception
    • OpsWorksCM
      • Exception
    • Organizations
      • Exception
    • Outposts
      • Exception
    • Panorama
      • Exception
    • Personalize
      • Exception
    • PersonalizeEvents
      • Exception
    • PersonalizeRuntime
      • Exception
    • PI
      • Exception
    • Pinpoint
      • Exception
    • PinpointEmail
      • Exception
    • PinpointSMSVoice
      • Exception
    • PinpointSMSVoiceV2
      • Exception
    • Pipes
      • Exception
    • Polly
      • Exception
    • Pricing
      • Exception
    • PrivateNetworks
      • Exception
    • PrometheusService
      • Exception
    • Proton
      • Exception
    • QLDB
      • Exception
    • QLDBSession
      • Exception
    • QuickSight
      • Exception
    • RAM
      • Exception
    • Rds
      • Exception
    • RDSDataService
      • Exception
    • RecycleBin
      • Exception
    • Redshift
      • Exception
    • RedshiftDataAPIService
      • Exception
    • RedshiftServerless
      • Exception
    • Rekognition
      • Exception
    • ResilienceHub
      • Exception
    • ResourceExplorer2
      • Exception
    • ResourceGroups
      • Exception
    • ResourceGroupsTaggingAPI
      • Exception
    • Retry
      • Exception
    • RoboMaker
      • Exception
    • RolesAnywhere
      • Exception
    • Route53
      • Exception
    • Route53Domains
      • Exception
    • Route53RecoveryCluster
      • Exception
    • Route53RecoveryControlConfig
      • Exception
    • Route53RecoveryReadiness
      • Exception
    • Route53Resolver
      • Exception
    • S3
      • Crypto
      • Exception
      • RegionalEndpoint
        • Exception
      • UseArnRegion
        • Exception
    • S3Control
      • Exception
    • S3Outposts
      • Exception
    • SageMaker
      • Exception
    • SagemakerEdgeManager
      • Exception
    • SageMakerFeatureStoreRuntime
      • Exception
    • SageMakerGeospatial
      • Exception
    • SageMakerMetrics
      • Exception
    • SageMakerRuntime
      • Exception
    • SavingsPlans
      • Exception
    • Scheduler
      • Exception
    • Schemas
      • Exception
    • Script
      • Composer
    • SecretsManager
      • Exception
    • SecurityHub
      • Exception
    • SecurityLake
      • Exception
    • ServerlessApplicationRepository
      • Exception
    • ServiceCatalog
      • Exception
    • ServiceDiscovery
      • Exception
    • ServiceQuotas
      • Exception
    • Ses
      • Exception
    • SesV2
      • Exception
    • Sfn
      • Exception
    • Shield
      • Exception
    • Signature
    • signer
      • Exception
    • SimSpaceWeaver
      • Exception
    • Sms
      • Exception
    • SnowBall
      • Exception
    • SnowDeviceManagement
      • Exception
    • Sns
      • Exception
    • Sqs
      • Exception
    • Ssm
      • Exception
    • SSMContacts
      • Exception
    • SSMIncidents
      • Exception
    • SsmSap
      • Exception
    • SSO
      • Exception
    • SSOAdmin
      • Exception
    • SSOOIDC
      • Exception
    • StorageGateway
      • Exception
    • Sts
      • Exception
      • RegionalEndpoints
        • Exception
    • Support
      • Exception
    • SupportApp
      • Exception
    • Swf
      • Exception
    • Synthetics
      • Exception
    • Textract
      • Exception
    • TimestreamQuery
      • Exception
    • TimestreamWrite
      • Exception
    • Tnb
      • Exception
    • Token
    • TranscribeService
      • Exception
    • Transfer
      • Exception
    • Translate
      • Exception
    • VoiceID
      • Exception
    • Waf
      • Exception
    • WafRegional
      • Exception
    • WAFV2
      • Exception
    • WellArchitected
      • Exception
    • WorkDocs
      • Exception
    • WorkLink
      • Exception
    • WorkMail
      • Exception
    • WorkMailMessageFlow
      • Exception
    • WorkSpaces
      • Exception
    • WorkSpacesWeb
      • Exception
    • XRay
      • Exception
  • GuzzleHttp
    • Promise
    • Psr7
  • Psr
    • Http
      • Message

Classes

  • HeadersMetadataStrategy
  • InstructionFileMetadataStrategy
  • S3EncryptionClient
  • S3EncryptionClientV2
  • S3EncryptionMultipartUploader
  • S3EncryptionMultipartUploaderV2

Traits

  • CryptoParamsTrait
  • CryptoParamsTraitV2
  • UserAgentTrait

Class S3EncryptionClient

Aws\Crypto\AbstractCryptoClient
Extended by Aws\S3\Crypto\S3EncryptionClient uses Aws\Crypto\Cipher\CipherBuilderTrait, Aws\S3\Crypto\CryptoParamsTrait, Aws\Crypto\DecryptionTrait, Aws\Crypto\EncryptionTrait, Aws\S3\Crypto\UserAgentTrait
Namespace: Aws\S3\Crypto
Deprecated
Located at S3/Crypto/S3EncryptionClient.php

Provides a wrapper for an S3Client that supplies functionality to encrypt data on putObject[Async] calls and decrypt data on getObject[Async] calls.

Legacy implementation using older encryption workflow.

AWS strongly recommends the upgrade to the S3EncryptionClientV2 (over the S3EncryptionClient), as it offers updated data security best practices to our customers who upgrade. S3EncryptionClientV2 contains breaking changes, so this will require planning by engineering teams to migrate. New workflows should just start with S3EncryptionClientV2.

Methods Summary

  • __construct ( Aws\S3\S3Client $client, string|null $instructionFileSuffix = null )
  • putObjectAsync ( array $args )

    Encrypts the data in the 'Body' field of $args and promises to upload it to the specified location on S3.

  • putObject ( array $args )

    Encrypts the data in the 'Body' field of $args and uploads it to the specified location on S3.

  • getObjectAsync ( array $args )

    Promises to retrieve an object from S3 and decrypt the data in the 'Body' field.

  • getObject ( array $args )

    Retrieves an object from S3 and decrypts the data in the 'Body' field.

Methods inherited from Aws\Crypto\AbstractCryptoClient

decrypt(), encrypt(), isSupportedCipher()

Methods Details

__construct ( Aws\S3\S3Client $client, string|null $instructionFileSuffix = null )

Parameters

Aws\S3\S3Client $client

The S3Client to be used for true uploading and retrieving objects from S3 when using the encryption client.

string|null $instructionFileSuffix = null

Suffix for a client wide default when using instruction files for metadata storage.

GuzzleHttp\Promise\PromiseInterface putObjectAsync ( array $args )

Encrypts the data in the 'Body' field of $args and promises to upload it to the specified location on S3.

Parameters

array $args

Arguments for encrypting an object and uploading it to S3 via PutObject.

The required configuration arguments are as follows:

  • @MaterialsProvider: (MaterialsProvider) Provides Cek, Iv, and Cek encrypting/decrypting for encryption metadata.
  • @CipherOptions: (array) Cipher options for encrypting data. Only the Cipher option is required. Accepts the following:
    • Cipher: (string) cbc|gcm See also: AbstractCryptoClient::$supportedCiphers. Note that cbc is deprecated and gcm should be used when possible.
    • KeySize: (int) 128|192|256 See also: MaterialsProvider::$supportedKeySizes
    • Aad: (string) Additional authentication data. This option is passed directly to OpenSSL when using gcm. It is ignored when using cbc. Note if you pass in Aad for gcm encryption, the PHP SDK will be able to decrypt the resulting object, but other AWS SDKs may not be able to do so.

The optional configuration arguments are as follows:

  • @MetadataStrategy: (MetadataStrategy|string|null) Strategy for storing MetadataEnvelope information. Defaults to using a HeadersMetadataStrategy. Can either be a class implementing MetadataStrategy, a class name of a predefined strategy, or empty/null to default.
  • @InstructionFileSuffix: (string|null) Suffix used when writing to an instruction file if using an InstructionFileMetadataHandler.

Returns

GuzzleHttp\Promise\PromiseInterface

Exceptions

InvalidArgumentException

Thrown when arguments above are not passed or are passed incorrectly.

Aws\Result putObject ( array $args )

Encrypts the data in the 'Body' field of $args and uploads it to the specified location on S3.

Parameters

array $args

Arguments for encrypting an object and uploading it to S3 via PutObject.

The required configuration arguments are as follows:

  • @MaterialsProvider: (MaterialsProvider) Provides Cek, Iv, and Cek encrypting/decrypting for encryption metadata.
  • @CipherOptions: (array) Cipher options for encrypting data. A Cipher is required. Accepts the following options:
    • Cipher: (string) cbc|gcm See also: AbstractCryptoClient::$supportedCiphers. Note that cbc is deprecated and gcm should be used when possible.
    • KeySize: (int) 128|192|256 See also: MaterialsProvider::$supportedKeySizes
    • Aad: (string) Additional authentication data. This option is passed directly to OpenSSL when using gcm. It is ignored when using cbc. Note if you pass in Aad for gcm encryption, the PHP SDK will be able to decrypt the resulting object, but other AWS SDKs may not be able to do so.

The optional configuration arguments are as follows:

  • @MetadataStrategy: (MetadataStrategy|string|null) Strategy for storing MetadataEnvelope information. Defaults to using a HeadersMetadataStrategy. Can either be a class implementing MetadataStrategy, a class name of a predefined strategy, or empty/null to default.
  • @InstructionFileSuffix: (string|null) Suffix used when writing to an instruction file if an using an InstructionFileMetadataHandler was determined.

Returns

Aws\Result

PutObject call result with the details of uploading the encrypted file.

Exceptions

InvalidArgumentException

Thrown when arguments above are not passed or are passed incorrectly.

GuzzleHttp\Promise\PromiseInterface getObjectAsync ( array $args )

Promises to retrieve an object from S3 and decrypt the data in the 'Body' field.

Parameters

array $args

Arguments for retrieving an object from S3 via GetObject and decrypting it.

The required configuration argument is as follows:

  • @MaterialsProvider: (MaterialsProvider) Provides Cek, Iv, and Cek encrypting/decrypting for decryption metadata. May have data loaded from the MetadataEnvelope upon decryption.

The optional configuration arguments are as follows:

  • SaveAs: (string) The path to a file on disk to save the decrypted object data. This will be handled by file_put_contents instead of the Guzzle sink.

  • @MetadataStrategy: (MetadataStrategy|string|null) Strategy for reading MetadataEnvelope information. Defaults to determining based on object response headers. Can either be a class implementing MetadataStrategy, a class name of a predefined strategy, or empty/null to default.

  • @InstructionFileSuffix: (string) Suffix used when looking for an instruction file if an InstructionFileMetadataHandler is being used.
  • @CipherOptions: (array) Cipher options for decrypting data. A Cipher is required. Accepts the following options:
    • Aad: (string) Additional authentication data. This option is passed directly to OpenSSL when using gcm. It is ignored when using cbc.

Returns

GuzzleHttp\Promise\PromiseInterface

Exceptions

InvalidArgumentException

Thrown when required arguments are not passed or are passed incorrectly.

Aws\Result getObject ( array $args )

Retrieves an object from S3 and decrypts the data in the 'Body' field.

Parameters

array $args

Arguments for retrieving an object from S3 via GetObject and decrypting it.

The required configuration argument is as follows:

  • @MaterialsProvider: (MaterialsProvider) Provides Cek, Iv, and Cek encrypting/decrypting for decryption metadata. May have data loaded from the MetadataEnvelope upon decryption.

The optional configuration arguments are as follows:

  • SaveAs: (string) The path to a file on disk to save the decrypted object data. This will be handled by file_put_contents instead of the Guzzle sink.
  • @InstructionFileSuffix: (string|null) Suffix used when looking for an instruction file if an InstructionFileMetadataHandler was detected.
  • @CipherOptions: (array) Cipher options for encrypting data. A Cipher is required. Accepts the following options:
    • Aad: (string) Additional authentication data. This option is passed directly to OpenSSL when using gcm. It is ignored when using cbc.

Returns

Aws\Result

GetObject call result with the 'Body' field wrapped in a decryption stream with its metadata information.

Exceptions

InvalidArgumentException

Thrown when arguments above are not passed or are passed incorrectly.

Constants summary

string CRYPTO_VERSION
# '1n'
AWS SDK for PHP 3.x API documentation generated by ApiGen