本文整理了Java中org.xipki.util.Base64.decodeFast()
方法的一些代码示例,展示了Base64.decodeFast()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64.decodeFast()
方法的具体详情如下:
包路径:org.xipki.util.Base64
类名称:Base64
方法名:decodeFast
[英]Decodes a BASE64 encoded string that is known to be resonably well formatted. The method is about twice as fast as #decode(String). The preconditions are:
代码示例来源:origin: org.xipki/ca-mgmt-client
private String getBase64HashValue(ResultSet rs) throws SQLException {
if (dbControl == DbControl.XIPKI_OCSP_v4) {
return rs.getString("HASH");
} else { // if (dbControl == DbControl.XIPKI_CA_v4) {
if (certhashAlgo == HashAlgo.SHA1) {
return rs.getString("SHA1");
} else {
String b64Cert = rs.getString("CERT");
byte[] encodedCert = Base64.decodeFast(b64Cert);
return certhashAlgo.base64Hash(encodedCert);
}
}
}
}
代码示例来源:origin: org.xipki/ca-dbtool
private String getBase64HashValue(ResultSet rs) throws SQLException {
if (dbControl == DbControl.XIPKI_OCSP_v4) {
return rs.getString("HASH");
} else { // if (dbControl == DbControl.XIPKI_CA_v4) {
if (certhashAlgo == HashAlgo.SHA1) {
return rs.getString("SHA1");
} else {
String b64Cert = rs.getString("CERT");
byte[] encodedCert = Base64.decodeFast(b64Cert);
return certhashAlgo.base64Hash(encodedCert);
}
}
}
}
代码示例来源:origin: org.xipki/ca-mgmt-client
private static Map<Integer, byte[]> getCas(DataSourceWrapper datasource, DbControl dbControl)
throws DataAccessException {
// get a list of available CAs in the target database
String sql = "SELECT ID,CERT FROM ";
if (dbControl == DbControl.XIPKI_CA_v4) {
sql += "CA";
} else if (dbControl == DbControl.XIPKI_OCSP_v4) {
sql += "ISSUER";
} else {
throw new IllegalArgumentException("unknown dbControl " + dbControl);
}
Statement stmt = datasource.createStatement();
Map<Integer, byte[]> caIdCertMap = new HashMap<>(5);
ResultSet rs = null;
try {
rs = stmt.executeQuery(sql);
while (rs.next()) {
caIdCertMap.put(rs.getInt("ID"), Base64.decodeFast(rs.getString("CERT")));
}
} catch (SQLException ex) {
throw datasource.translate(sql, ex);
} finally {
datasource.releaseResources(stmt, rs);
}
return caIdCertMap;
}
代码示例来源:origin: org.xipki/ca-dbtool
private static Map<Integer, byte[]> getCas(DataSourceWrapper datasource, DbControl dbControl)
throws DataAccessException {
// get a list of available CAs in the target database
String sql = "SELECT ID,CERT FROM ";
if (dbControl == DbControl.XIPKI_CA_v4) {
sql += "CA";
} else if (dbControl == DbControl.XIPKI_OCSP_v4) {
sql += "ISSUER";
} else {
throw new IllegalArgumentException("unknown dbControl " + dbControl);
}
Connection conn = datasource.getConnection();
Statement stmt = datasource.createStatement(conn);
Map<Integer, byte[]> caIdCertMap = new HashMap<>(5);
ResultSet rs = null;
try {
rs = stmt.executeQuery(sql);
while (rs.next()) {
caIdCertMap.put(rs.getInt("ID"), Base64.decodeFast(rs.getString("CERT")));
}
} catch (SQLException ex) {
throw datasource.translate(sql, ex);
} finally {
datasource.releaseResources(stmt, rs);
}
return caIdCertMap;
}
代码示例来源:origin: org.xipki/ca-mgmt-client
hash = rs.getString("SHA1");
} else {
hash = certhashAlgo.base64Hash(Base64.decodeFast(rs.getString("CERT")));
代码示例来源:origin: org.xipki/ca-dbtool
hash = rs.getString("SHA1");
} else {
hash = certhashAlgo.base64Hash(Base64.decodeFast(rs.getString("CERT")));
代码示例来源:origin: org.xipki/ca-server
public byte[] getEncodedCrl(NameId ca, BigInteger crlNumber) throws OperationException {
Args.notNull(ca, "ca");
String sql = (crlNumber == null) ? sqlCrl : sqlCrlWithNo;
ResultSet rs = null;
PreparedStatement ps = borrowPreparedStatement(sql);
String b64Crl = null;
try {
int idx = 1;
ps.setInt(idx++, ca.getId());
if (crlNumber != null) {
ps.setLong(idx++, crlNumber.longValue());
}
rs = ps.executeQuery();
long currentThisUpdate = 0;
// iterate all entries to make sure that the latest CRL will be returned
while (rs.next()) {
long thisUpdate = rs.getLong("THISUPDATE");
if (thisUpdate >= currentThisUpdate) {
b64Crl = rs.getString("CRL");
currentThisUpdate = thisUpdate;
}
}
} catch (SQLException ex) {
throw new OperationException(DATABASE_FAILURE, datasource.translate(sql, ex).getMessage());
} finally {
datasource.releaseResources(ps, rs);
}
return (b64Crl == null) ? null : Base64.decodeFast(b64Crl);
} // method getEncodedCrl
代码示例来源:origin: org.xipki/ca-server
byte[] encodedCert = Base64.decodeFast(b64Cert);
代码示例来源:origin: org.xipki/ca-server
return (b64Req == null) ? null : Base64.decodeFast(b64Req);
代码示例来源:origin: org.xipki/ca-server
byte[] encodedCert = Base64.decodeFast(b64Cert);
X509Certificate cert = X509Util.parseCert(encodedCert);
CertWithDbId certWithMeta = new CertWithDbId(cert, encodedCert);
代码示例来源:origin: org.xipki/ca-server
byte[] certBytes = Base64.decodeFast(b64Cert);
X509Certificate cert;
try {
代码示例来源:origin: org.xipki/ca-server
byte[] encodedCert = Base64.decodeFast(b64Cert);
X509Certificate cert = X509Util.parseCert(encodedCert);
代码示例来源:origin: org.xipki/ca-dbtool
byte[] certBytes = Base64.decodeFast(rs.getString("CERT"));
byte[] crlBytes = Base64.decodeFast(rs.getString("CRL"));
byte[] dataBytes = Base64.decodeFast(rs.getString("DATA"));
String sha1 = HashAlgo.SHA1.hexHash(dataBytes);
final String dataFilename = sha1 + ".req";
代码示例来源:origin: org.xipki/ca-mgmt-client
byte[] certBytes = Base64.decodeFast(rs.getString("CERT"));
((CaCertstore.Certs) entriesInCurrentFile).add(cert);
} else if (CaDbEntryType.CRL == type) {
byte[] crlBytes = Base64.decodeFast(rs.getString("CRL"));
((CaCertstore.Crls) entriesInCurrentFile).add(crl);
} else if (CaDbEntryType.REQUEST == type) {
byte[] dataBytes = Base64.decodeFast(rs.getString("DATA"));
String sha1 = HashAlgo.SHA1.hexHash(dataBytes);
final String dataFilename = sha1 + ".req";
代码示例来源:origin: org.xipki/ca-server
if (hdrValue.length() > 6) {
String b64 = hdrValue.substring(6);
byte[] userPwd = Base64.decodeFast(b64);
int idx = -1;
for (int i = 0; i < userPwd.length; i++) {
内容来源于网络,如有侵权,请联系作者删除!