2017-08-07 171 views
0

我使用CodeBuild步驟構建了一個CodePipeline步驟,該步驟會生成帶有單個行標記信息的文件「build.json」作爲輸出。該文件是Codepipeline中下一個Lambda步驟的輸入。 Lambda函數想要讀取標籤信息,然後對其進行操作。因此,我閱讀S3 ::的getObject的S3對象,並作爲迴應,我得到:解密AWS Codepipeline中的Lambda函數中的輸入參數

{ 
"AcceptRanges": "bytes", 
"LastModified": "2017-08-07T00:25:22.000Z", 
"ContentLength": 158, 
"ETag": "\"4444a193ad79ffe0ec0bd51ce7cf297c\"", 
"ContentType": "", 
"ServerSideEncryption": "aws:kms", 
"Metadata": { 
    "codebuild-content-sha256": "fa85881e29d5b68464b078243ac23754189741e244bbf2d3748c02d97885ff51", 
    "codebuild-content-md5": "44444449e8f4b830a487b86e1e94c0" 
}, 
"SSEKMSKeyId": "arn:aws:kms:eu-central-1:813287844011:key/4444444-0db2-4c3c-b24e-20ff7bbe206a", 
"Body": { 
    "type": "Buffer", 
    "data": [ 
     80, 
     75, 
     3,...]}} 

當我使用的內容和發送給公里解密,如:

kms.decrypt({ CiphertextBlob: mydata.Metadata["codebuild-content-sha256"] }, function (err, kmsData) { 
if (err) { 
    console.log("ERROR " + err); 
} else { 
    console.log("SUCCESS"); 
} 

我只得到:ERROR InvalidCiphertextException:null。

我也嘗試提供一些其他的值作爲Encryptioncontext,但沒有運氣。

謝謝。

回答