longtone Posted May 8, 2008 Share Posted May 8, 2008 Is there a simple way to create a digital signature in PHP? Or even a complicated way would do... Link to comment https://forums.phpfreaks.com/topic/104721-solved-how-to-create-a-digital-signature/ Share on other sites More sharing options...
discomatt Posted May 8, 2008 Share Posted May 8, 2008 I'm not sure what you mean? PHP has many hashing functions, if that's what you're after. md5()... sha1()... hash()... Link to comment https://forums.phpfreaks.com/topic/104721-solved-how-to-create-a-digital-signature/#findComment-535975 Share on other sites More sharing options...
Fadion Posted May 8, 2008 Share Posted May 8, 2008 Or probably he's talking about watermarking photos?!!?!!?! Then take a look at GD. Link to comment https://forums.phpfreaks.com/topic/104721-solved-how-to-create-a-digital-signature/#findComment-536006 Share on other sites More sharing options...
longtone Posted May 8, 2008 Author Share Posted May 8, 2008 I'm not sure what you mean? Sorry, I'll be more specific: I want to use the Youtube API with secure authentication. I have just got an SSL certificate and uploaded a copy to Google. Now I need to use it to create a digital signature for requests: Signing Requests All requests to Google services using a secure authentication token must be signed. This includes calls to AuthSubSessionToken, AuthSubRevokeToken, AuthSubTokenInfo, and all requests made to Google services. This section describes how to include a signature in a request. As mentioned, secure tokens are issued only to web sites or applications that have registered with Google. Part of the registration process includes providing a certificate to Google. To sign requests, the web application generates a signature from the private key corresponding to the certificate. Google supports the RSA signature algorithm, and may support additional signature algorithms in the future. When a signed request is received, the Google service verifies the signature before granting access. Requests using a secure token are denied if they are not signed. Note: Some Google services respond to a request with a redirect. In this case, the redirected request must also be signed. A signature is added to the "Authorization" header of the request, along with the authentication token. The header should take the form: Authorization: AuthSub token="token" sigalg="sigalg" data="data" sig="sig" Parameter Description token (required) The authentication token received from Google in response to an AuthSubRequest call. sigalg (required if token is secure) Signature algorithm. The only legal value for this parameter is "rsa-sha1", referring to SHA-1 with RSA using PKCS#1 padding. In the future, more signature algorithms may be supported. data (required if token is secure) The request metadata to be signed. The value of this parameter is a string with the following format: data = http-method SP http-request-URL SP timestamp SP nonce http-method: the HTTP method being invoked SP: a single ASCII space character http-request-URL: the full HTTP URL being requested timestamp: an integer representing the time the request was sent, expressed in number of seconds after January 1, 1970 00:00:00 GMT nonce: a random 64-bit, unsigned number encoded as an ASCII string in decimal A timestamp/nonce combination should never be used more than once. sig (required if token is secure) The signature for the secure token. This value must be a signature made by the private key corresponding to the certificate provided during registration. It must be encoded in BASE64, and must use the algorithm specified in the sigalg parameter. (more info : http://code.google.com/apis/accounts/docs/AuthForWebApps.html#signingrequests So I need a function that will encrypt the data in exactly the way Google are expecting. Link to comment https://forums.phpfreaks.com/topic/104721-solved-how-to-create-a-digital-signature/#findComment-536072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.