com.netease.cloud.services.nos.internal.NosStringSigner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nos-sdk-java-publiccloud Show documentation
Show all versions of nos-sdk-java-publiccloud Show documentation
nos java sdk to the Central Repository
The newest version!
package com.netease.cloud.services.nos.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.netease.cloud.auth.AbstractStringSigner;
import com.netease.cloud.auth.Credentials;
import com.netease.cloud.auth.SigningAlgorithm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class NosStringSigner extends AbstractStringSigner {
/** Shared log for signing debug output */
private static final Logger log = LoggerFactory.getLogger(NosStringSigner.class);
@Override
public String sign(String stringToSign, Credentials credentials) {
if (credentials == null) {
log.debug("Canonical string will not be signed, as no Secret Key was provided");
return null;
}
Credentials sanitizedCredentials = sanitizeCredentials(credentials);
String signature = super.signAndBase64Encode(stringToSign, sanitizedCredentials.getSecretKey(),
SigningAlgorithm.HmacSHA256);
return signature;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy