本文整理汇总了Java中com.subgraph.orchid.encoders.Base64类的典型用法代码示例。如果您正苦于以下问题:Java Base64类的具体用法?Java Base64怎么用?Java Base64使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Base64类属于com.subgraph.orchid.encoders包,在下文中一共展示了Base64类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseBase64Data
import com.subgraph.orchid.encoders.Base64; //导入依赖的package包/类
public byte[] parseBase64Data() {
final StringBuilder string = new StringBuilder(getItem());
switch(string.length() % 4) {
case 2:
string.append("==");
break;
case 3:
string.append("=");
break;
default:
break;
}
try {
return Base64.decode(string.toString().getBytes("ISO-8859-1"));
} catch (UnsupportedEncodingException e) {
throw new TorException(e);
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:20,代码来源:DocumentFieldParserImpl.java
示例2: createFromBase64
import com.subgraph.orchid.encoders.Base64; //导入依赖的package包/类
private HSDescriptorCookie createFromBase64(String b64) {
if(b64.length() != 22) {
throw new IllegalArgumentException();
}
final byte[] decoded = Base64.decode(b64 + "A=");
final byte lastByte = decoded[decoded.length - 1];
final int flag = (lastByte & 0xFF) >> 4;
final byte[] cookie = new byte[decoded.length - 1];
System.arraycopy(decoded, 0, cookie, 0, cookie.length);
switch(flag) {
case 0:
return new HSDescriptorCookie(CookieType.COOKIE_BASIC, cookie);
case 1:
return new HSDescriptorCookie(CookieType.COOKIE_STEALTH, cookie);
default:
throw new TorException("Illegal cookie descriptor with flag value: "+ flag);
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:19,代码来源:TorConfigHSAuth.java
示例3: toBase64
import com.subgraph.orchid.encoders.Base64; //导入依赖的package包/类
public String toBase64(boolean stripTrailingEquals) {
final String b64 = new String(Base64.encode(digestBytes), Tor.getDefaultCharset());
if(stripTrailingEquals) {
return stripTrailingEquals(b64);
} else {
return b64;
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:HexDigest.java
示例4: createIntroductionPointBuffer
import com.subgraph.orchid.encoders.Base64; //导入依赖的package包/类
private ByteBuffer createIntroductionPointBuffer(DocumentObject ob) {
final byte[] content = Base64.decode(ob.getContent(false));
if(content[0] == 'i') {
return ByteBuffer.wrap(content);
} else {
try {
byte[] decrypted = authentication.decryptIntroductionPoints(content);
return ByteBuffer.wrap(decrypted);
} catch (HSAuthenticationException e) {
throw new TorParsingException("Failed to decrypt introduction points: "+ e.getMessage());
}
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:14,代码来源:HSDescriptorParser.java
示例5: createFromPEMBuffer
import com.subgraph.orchid.encoders.Base64; //导入依赖的package包/类
static public TorSignature createFromPEMBuffer(String buffer) {
BufferedReader reader = new BufferedReader(new StringReader(buffer));
final String header = nextLine(reader);
if(!(SIGNATURE_BEGIN.equals(header) || ID_SIGNATURE_BEGIN.equals(header)))
throw new TorParsingException("Did not find expected signature BEGIN header");
return new TorSignature(Base64.decode(parseBase64Data(reader)), DigestAlgorithm.DIGEST_SHA1);
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:8,代码来源:TorSignature.java
示例6: decodeAsciiArmoredPEM
import com.subgraph.orchid.encoders.Base64; //导入依赖的package包/类
private byte[] decodeAsciiArmoredPEM(String pem) {
final String trimmed = removeDelimiters(pem);
return Base64.decode(trimmed);
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:5,代码来源:RSAKeyEncoder.java
注:本文中的com.subgraph.orchid.encoders.Base64类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论