dennysutanto
05/26/2021, 7:43 AMbattk
05/26/2021, 8:47 AMbattk
05/26/2021, 8:47 AMbattk
05/26/2021, 8:48 AMbattk
05/26/2021, 8:49 AMdennysutanto
05/26/2021, 9:07 AM// Create Signature Hash
$signature = hash_hmac('sha256', $base64UrlHeader . "." . $base64UrlPayload, 'abC123!', true);
dennysutanto
05/26/2021, 9:09 AMcrypto.createHmac
, i understand that the key is coming from NS, so seems like it's for different purposedennysutanto
05/26/2021, 9:10 AMbattk
05/26/2021, 9:11 AMbattk
05/26/2021, 9:13 AMbattk
05/26/2021, 9:15 AMbattk
05/26/2021, 9:17 AMbattk
05/26/2021, 9:18 AMdennysutanto
05/26/2021, 9:23 AMdennysutanto
05/26/2021, 9:27 AMyou store the secret used for creating the secret key using Secrets Management
You're saying that i store the google secret key as a new key in NS Secrets Management ?battk
05/26/2021, 9:44 AMbattk
05/26/2021, 9:46 AMdennysutanto
05/26/2021, 9:49 AMmichoel
05/26/2021, 10:09 AMbattk
05/26/2021, 10:21 AMdennysutanto
05/27/2021, 2:52 AMhmacSHA256.digest
. The error is AN_ERROR_OCCURRED_WHILE_DECRYPT_PASSWORDGUID
This is part of my script, i cannot find out why
const headerBase64 = encode.convert({
string: googleHeader,
inputEncoding: encode.Encoding.UTF_8,
outputEncoding: encode.Encoding.BASE_64
});
const claimsetBase64 = encode.convert({
string: claimSet,
inputEncoding: encode.Encoding.UTF_8,
outputEncoding: encode.Encoding.BASE_64
});
var inputString = headerBase64 + '.' + claimsetBase64;
var secretKey = crypto.createSecretKey({
encoding: encode.Encoding.HEX,
secret: 'mysecret'
});
var hmacSHA256 = crypto.createHmac({
algorithm: crypto.HashAlg.SHA256,
key: secretKey
});
hmacSHA256.update({
input: inputString
});
var digestSHA256 = hmacSHA256.digest({
outputEncoding: encode.Encoding.HEX
});
battk
05/27/2021, 2:59 AMbattk
05/27/2021, 2:59 AMdennysutanto
05/27/2021, 3:37 AMdennysutanto
05/27/2021, 3:37 AMdennysutanto
05/27/2021, 3:42 AM-----BEGIN PRIVATE KEY-----\nMIIEvxxxxxxx
, is the one to be inputed in password
field when creating new API Secret, right ?battk
05/27/2021, 3:45 AMbattk
05/27/2021, 3:46 AMbattk
05/27/2021, 3:50 AMbattk
05/27/2021, 3:55 AMdennysutanto
05/27/2021, 4:14 AMbattk
05/27/2021, 4:20 AMSign the JWT with RSA-256 using the private key found in your service account JSON file.
battk
05/27/2021, 4:20 AMbattk
05/27/2021, 4:21 AMdennysutanto
05/27/2021, 4:24 AM// Create Signature Hash
$signature = hash_hmac('sha256', $base64UrlHeader . "." . $base64UrlPayload, 'abC123!', true);
dennysutanto
05/27/2021, 4:31 AMbattk
05/27/2021, 4:31 AMdennysutanto
05/27/2021, 4:37 AMdennysutanto
05/27/2021, 4:50 AMbattk
05/27/2021, 4:50 AMdennysutanto
05/27/2021, 6:50 AMdennysutanto
05/27/2021, 6:51 AMbattk
05/27/2021, 5:36 PMbattk
05/27/2021, 5:37 PMbattk
05/27/2021, 5:38 PMbattk
05/27/2021, 5:40 PM