2017-08-07 169 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,但没有运气。

谢谢。

回答