Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to extract a SHA1 Certificate field using crypto object ?

Not applicable

I need to have a API proxy where I send in SHA1 certificate and extract a certain field from it.

The certificate would be sent to the proxy as a part of the incoming request header and it would extract the field value from it.

Went about using the crypto object :-

Please find the code below:-

var _sha1 = crypto.getSHA1();

var issuer=_sha1.Issuer;

if(issuer!==null)

{ context.proxyResponse.content='success'; }

else

{ context.proxyResponse.content='failure'; }

But I'm getting a this error:-

{ "fault": { "faultstring": "Execution of extract-from-cert failed with error: Javascript runtime error: \"ReferenceError: \"crypto\" is not defined. (JavaScript_1_js#1). at line 1 \"", "detail": { "errorcode": "steps.javascript.ScriptExecutionFailed" } } }

Please help.

If this is not feasible in Apigee can anyone please suggest some alternatives.

0 8 1,071
8 REPLIES 8