Classic ASP
Classic ASP
Set the JWS Protected Header
See more JSON Web Signatures (JWS) Examples
Demonstrates Jws.SetProtectedHeader, which sets the integrity-protected header for a signer from a JsonObject. The header specifies the signature algorithm (alg).
Background. The protected header is covered by the signature, so it cannot be altered without invalidating the JWS. It is configured before creating the JWS.
Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
set jws = Server.CreateObject("Chilkat.Jws")
' Build the JWS protected header. The "alg" member names the signature algorithm.
set header = Server.CreateObject("Chilkat.JsonObject")
success = header.UpdateString("alg","HS256")
' Set the protected header for signer index 0. The protected header is integrity-protected: it is
' covered by the signature.
success = jws.SetProtectedHeader(0,header)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( jws.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Protected header set.") & "</pre>"
%>
</body>
</html>