code: public void sign(SignableRequest<?> request, SignatureVersion version,
              SigningAlgorithm algorithm, AWSCredentials credentials)
              throws SdkClientException {
          // annonymous credentials, don't sign
          if ( credentials instanceof AnonymousAWSCredentials ) {
              return;
          }
  
          AWSCredentials sanitizedCredentials = sanitizeCredentials(credentials);
          request.addParameter("AWSAccessKeyId", sanitizedCredentials.getAWSAccessKeyId());
          request.addParameter("SignatureVersion", version.toString());
  
          int timeOffset = request.getTimeOffset();
          request.addParameter("Timestamp", getFormattedTimestamp(timeOffset));
  
          if ( sanitizedCredentials instanceof AWSSessionCredentials ) {
              addSessionCredentials(request, (AWSSessionCredentials) sanitizedCredentials);
          }
  
          String stringToSign = null;
          if ( version.equals( SignatureVersion.V1 ) ) {
              stringToSign = calculateStringToSignV1(request.getParameters());
          } else if ( version.equals( SignatureVersion.V2 ) ) {
              request.addParameter("SignatureMethod", algorithm.toString());
              stringToSign = calculateStringToSignV2(request);
          } else {
              throw new SdkClientException("Invalid Signature Version specified");
          }
  
          String signatureValue = signAndBase64Encode(stringToSign,
                  sanitizedCredentials.getAWSSecretKey(), algorithm);
          request.addParameter("Signature", signatureValue);
      }
docs: This signer will add following authentication parameters to the request:
  
  AWSAccessKeyId SignatureVersion SignatureMethod Timestamp Signature
  
  @param request
  request to be signed.
  
  @param version
  signature version. "2" is recommended.
  
  @param algorithm
  signature algorithm. "HmacSHA256" is recommended.