cl-k-takahashi edited a comment on issue #29: Fix the string to sign
URL: 
https://github.com/apache/cloudstack-documentation/pull/29#issuecomment-479715814
 
 
   @DaanHoogland 
   Current CloudStack contains the code below in ApiServer.java:
   `
    unsignedRequest = unsignedRequest.toLowerCase();
   
               final Mac mac = Mac.getInstance("HmacSHA1");
               final SecretKeySpec keySpec = new 
SecretKeySpec(secretKey.getBytes(), "HmacSHA1");
               mac.init(keySpec);
               mac.update(unsignedRequest.getBytes());
   `
   As you can see, CloudStack generates hash for lower cased request.
   Current documentation is not problematic for [a-zA-Z0-9] but is problematic 
for urlencoded characters:
   
   ```
   >>> urllib.quote_plus('aBcDe'.lower())
   'abcde'
   >>> urllib.quote_plus('aBcDe').lower()
   'abcde'
   >>> urllib.quote_plus('aBcDe★'.lower())
   'abcde%E2%98%85'
   >>> urllib.quote_plus('aBcDe★').lower()
   'abcde%e2%98%85'
   
   ```
   The 3rd result contains upper-case characters which causes verification 
failure in CloudStack management server.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to