本文整理了Java中com.sun.org.apache.xerces.internal.impl.dv.util.Base64.decode()
方法的一些代码示例,展示了Base64.decode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64.decode()
方法的具体详情如下:
包路径:com.sun.org.apache.xerces.internal.impl.dv.util.Base64
类名称:Base64
方法名:decode
[英]Decodes Base64 data into octects
[中]将Base64数据解码为八位字节
代码示例来源:origin: shawntime/shawn-common-utils
/**
* 解密
*
* @param decryptString
* @param decryptKey
* @return
* @throws Exception
*/
public static String decryptDES(String decryptString, String decryptKey)
throws Exception {
IvParameterSpec iv = new IvParameterSpec(iv1);
SecretKeySpec key = new SecretKeySpec(decryptKey.getBytes(), "DES");
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, key, iv);
return new String(cipher.doFinal(Base64.decode(decryptString)));
}
代码示例来源:origin: com.brienwheeler.apps/apps-tomcat
private List<X509Certificate> readCertFile() throws IOException, CertificateException {
List<String> items = readPEMFileIntoItems(sslCertFile);
if (items.size() < 1)
throw new IllegalArgumentException("invalid certificate file contents");
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
ArrayList<X509Certificate> certificates = new ArrayList<X509Certificate>();
for (int i=0; i<items.size(); i++) {
Matcher matcher = CERT_PATTERN.matcher(items.get(i));
if (!matcher.matches())
throw new IllegalArgumentException("invalid certificate file contents");
certificates.add((X509Certificate) certificateFactory.generateCertificate(new ByteArrayInputStream(Base64.decode(matcher.group(1)))));
}
return certificates;
}
代码示例来源:origin: stackoverflow.com
package edu.sasik.test.encoding;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
public class TestBase64 {
public static void main(String[] args) {
String base64Str = Base64.encode("Hello World!".getBytes());
System.out.println(base64Str);
byte[] bytes = Base64.decode(base64Str);
System.out.println(new String(bytes));
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
byte[] decoded = Base64.decode(content);
if (decoded == null)
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "base64Binary"});
return new XBase64(decoded);
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
byte[] decoded = Base64.decode(content);
if (decoded == null)
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "base64Binary"});
return new XBase64(decoded);
}
代码示例来源:origin: com.brienwheeler.apps/apps-tomcat
private RSAPrivateKey readKeyFile() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
List<String> items = readPEMFileIntoItems(sslKeyFile);
if (items.size() != 1)
throw new IllegalArgumentException("invalid key file contents");
Matcher matcher = KEY_PATTERN.matcher(items.get(0));
if (!matcher.matches())
throw new IllegalArgumentException("invalid key file contents");
String keyType = matcher.group(1);
String keyData = matcher.group(2);
if (keyType.length() == 0) { // BEGIN PRIVATE KEY
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
return (RSAPrivateKey) keyFactory.generatePrivate(new PKCS8EncodedKeySpec(Base64.decode(keyData)));
}
if (keyType.contains("RSA")) { // BEGIN RSA PRIVATE KEY
Security.addProvider(new BouncyCastleProvider());
PEMParser pemParser = new PEMParser(new FileReader(sslKeyFile));
Object parsedObject = pemParser.readObject();
if (!(parsedObject instanceof PEMKeyPair))
throw new IllegalArgumentException("invalid key file contents");
PEMKeyPair keyPair = (PEMKeyPair) parsedObject;
RSAPrivateKey privateKey = (RSAPrivateKey) BouncyCastleProvider.getPrivateKey(keyPair.getPrivateKeyInfo());
if (privateKey == null)
throw new IllegalArgumentException("invalid key file contents");
return privateKey;
}
throw new IllegalArgumentException("invalid key file contents");
}
代码示例来源:origin: stackoverflow.com
if (text != null) {
byte[] decode = Base64.decode(text);
GZIPInputStream zis = null;
try {
代码示例来源:origin: stackoverflow.com
String[] encrypted = encrypt(password, Base64.decode(salt));
代码示例来源:origin: stackoverflow.com
Security.addProvider(new BouncyCastleProvider());
String endpoint = "https://updates.push.services.mozilla.com/push/v1/xxx";
final byte[] alicePubKeyEnc = Base64.decode("base64 encoded public key ");
内容来源于网络,如有侵权,请联系作者删除!