本文整理汇总了Java中com.yahoo.athenz.auth.util.Crypto.ybase64DecodeString方法的典型用法代码示例。如果您正苦于以下问题:Java Crypto.ybase64DecodeString方法的具体用法?Java Crypto.ybase64DecodeString怎么用?Java Crypto.ybase64DecodeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.yahoo.athenz.auth.util.Crypto
的用法示例。
在下文中一共展示了Crypto.ybase64DecodeString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processServiceIdentityPublicKey
import com.yahoo.athenz.auth.util.Crypto; //导入方法依赖的package包/类
void processServiceIdentityPublicKey(String serviceName, String keyId, String publicKey) {
if (publicKey == null) {
return;
}
String keyValue = null;
try {
keyValue = Crypto.ybase64DecodeString(publicKey);
} catch (CryptoException ex) {
LOGGER.error("Invalid public key for " + serviceName + " with id " + keyId
+ " with value '" + publicKey + "':" + ex.getMessage());
}
if (keyValue != null) {
publicKeyCache.put(generateServiceKeyName(serviceName, keyId), keyValue);
}
}
示例2: testEnDecodedFile
import com.yahoo.athenz.auth.util.Crypto; //导入方法依赖的package包/类
@Test
public void testEnDecodedFile(){
String encoded = Crypto.encodedFile(argFile);
assertNotNull(encoded);
String decoded = Crypto.ybase64DecodeString(encoded);
assertEquals(decoded, "check\n");
}
示例3: testEncodedFileStream
import com.yahoo.athenz.auth.util.Crypto; //导入方法依赖的package包/类
@Test
public void testEncodedFileStream() throws Exception {
try (FileInputStream in = new FileInputStream(argFile)) {
String encoded = Crypto.encodedFile(in);
assertNotNull(encoded);
String decoded = Crypto.ybase64DecodeString(encoded);
assertEquals(decoded, "check");
} catch (Exception e){
fail();
}
}
示例4: getPublicKey
import com.yahoo.athenz.auth.util.Crypto; //导入方法依赖的package包/类
/**
* implements KeyStore getPublicKey
* @return String with PEM encoded key, which should be ybase64decoded prior
* to return if ybase64encoded
**/
@Override
public String getPublicKey(String domain, String service, String keyId) {
if (LOG.isDebugEnabled()) {
LOG.debug("getPublicKey: service=" + domain + "." + service + " key-id=" + keyId);
}
if (service == null || keyId == null) {
return null;
}
// for consistent handling of all requests, we're going to convert
// all incoming object values into lower case (e.g. domain, role,
// policy, service, etc name)
domain = domain.toLowerCase();
service = service.toLowerCase();
keyId = keyId.toLowerCase();
// special handling for service sys.auth.zms which is ourselves
// so we'll just lookup our key in our map
String pubKey = null;
if (isZMSService(domain, service)) {
pubKey = serverPublicKeyMap.get(keyId);
}
// if it's not the ZMS Server public key then lookup the
// public key from ZMS data
if (pubKey == null) {
try {
PublicKeyEntry keyEntry = dbService.getServicePublicKeyEntry(domain, service, keyId, true);
if (keyEntry != null) {
pubKey = keyEntry.getKey();
}
} catch (ResourceException ex) {
if (LOG.isDebugEnabled()) {
LOG.debug("getPublicKey: unable to get public key: " + ex.getMessage());
}
return null;
}
}
if (pubKey == null) {
if (LOG.isWarnEnabled()) {
LOG.warn("getPublicKey: service=" + domain + "." + service + " has no public key registered");
}
return null;
}
if (LOG.isDebugEnabled()) {
LOG.debug("getPublicKey: service public key: " + pubKey);
}
return Crypto.ybase64DecodeString(pubKey);
}