本文整理了Java中org.xipki.util.IoUtil.read()
方法的一些代码示例,展示了IoUtil.read()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IoUtil.read()
方法的具体详情如下:
包路径:org.xipki.util.IoUtil
类名称:IoUtil
方法名:read
暂无
代码示例来源:origin: xipki/xipki
public byte[] readContent() throws IOException {
if (binary != null) {
return binary;
}
return IoUtil.read(file);
}
代码示例来源:origin: org.xipki/util
public byte[] readContent() throws IOException {
if (binary != null) {
return binary;
}
return IoUtil.read(file);
}
代码示例来源:origin: xipki/xipki
public String readContent() throws IOException {
if (value != null) {
return value;
}
return new String(IoUtil.read(file), "UTF-8");
}
代码示例来源:origin: org.xipki/util
public String readContent() throws IOException {
if (value != null) {
return value;
}
return new String(IoUtil.read(file), "UTF-8");
}
代码示例来源:origin: org.xipki/ca-api
private static byte[] getBinary(String fileName, Map<String, String> properties, String baseDir)
throws IOException {
fileName = expandConf(fileName, properties);
InputStream is = Files.newInputStream(Paths.get(resolveFilePath(fileName, baseDir)));
return IoUtil.read(is);
}
代码示例来源:origin: org.xipki/ca-dbtool
protected String value(FileOrValueType fileOrValue) throws IOException {
if (fileOrValue == null) {
return null;
}
if (fileOrValue.getValue() != null) {
return fileOrValue.getValue();
}
File file = new File(baseDir, fileOrValue.getFile());
return new String(IoUtil.read(file), "UTF-8");
}
代码示例来源:origin: org.xipki/security
public static X509Certificate parseCert(InputStream certStream)
throws IOException, CertificateException {
Args.notNull(certStream, "certStream");
return parseCert(IoUtil.read(certStream));
}
代码示例来源:origin: org.xipki/ca-mgmt-client
protected String readContent(FileOrValue fileOrValue) throws IOException {
if (fileOrValue == null) {
return null;
}
if (fileOrValue.getValue() != null) {
return fileOrValue.getValue();
}
File file = new File(baseDir, fileOrValue.getFile());
return new String(IoUtil.read(file), "UTF-8");
}
代码示例来源:origin: org.xipki/security
public static org.bouncycastle.asn1.x509.Certificate parseBcCert(InputStream certStream)
throws IOException, CertificateException {
Args.notNull(certStream, "certStream");
return parseBcCert(IoUtil.read(certStream));
}
代码示例来源:origin: org.xipki/security
public static CertificationRequest parseCsr(InputStream csrStream) throws IOException {
Args.notNull(csrStream, "csrStream");
return parseCsr(IoUtil.read(csrStream));
}
代码示例来源:origin: org.xipki/security
private X509Cert readCertificate(byte[] keyId) throws CertificateException, IOException {
byte[] encoded = IoUtil.read(new File(certDir, hex(keyId) + VALUE_FILE_SUFFIX));
X509Certificate cert = X509Util.parseCert(encoded);
return new X509Cert(cert, encoded);
}
代码示例来源:origin: org.xipki/ca-dbtool
protected byte[] binary(FileOrBinaryType fileOrValue) throws IOException {
if (fileOrValue == null) {
return null;
}
if (fileOrValue.getBinary() != null) {
return fileOrValue.getBinary();
}
File file = new File(baseDir, fileOrValue.getFile());
return IoUtil.read(file);
}
代码示例来源:origin: org.xipki/ca-mgmt-client
protected byte[] readContent(FileOrBinary fileOrBinary) throws IOException {
if (fileOrBinary == null) {
return null;
}
if (fileOrBinary.getBinary() != null) {
return fileOrBinary.getBinary();
}
File file = new File(baseDir, fileOrBinary.getFile());
return IoUtil.read(file);
}
代码示例来源:origin: org.xipki.shell/ca-mgmt-shell
@Override
protected Object execute0() throws Exception {
String msg = "configuration to file " + confFile;
try {
InputStream is = caManager.exportConf(caNames);
save(new File(confFile), IoUtil.read(is));
println("exported " + msg);
return null;
} catch (CaMgmtException ex) {
throw new CmdFailure("could not export " + msg + ", error: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: org.xipki.shell/ca-mgmt-shell
@Override
protected Object execute0() throws Exception {
if (type == null && conf == null && confFile == null) {
throw new IllegalCmdParamException("nothing to update");
}
if (conf == null && confFile != null) {
conf = new String(IoUtil.read(confFile));
}
String msg = "certificate profile " + name;
try {
caManager.changeCertprofile(name, type, conf);
println("updated " + msg);
return null;
} catch (CaMgmtException ex) {
throw new CmdFailure("could not update " + msg + ", error: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: org.xipki.shells/security-shell
@Override
protected Object execute0() throws Exception {
CertificationRequest csr = X509Util.parseCsr(IoUtil.read(csrFile));
String sigAlgo = AlgorithmUtil.getSignatureAlgoName(csr.getSignatureAlgorithm());
boolean bo = securityFactory.verifyPopo(csr, null);
String txt = bo ? "valid" : "invalid";
println("The POP is " + txt + " (signature algorithm " + sigAlgo + ").");
return null;
}
代码示例来源:origin: org.xipki.shell/ca-mgmt-shell
@Override
protected Object execute0() throws Exception {
if (conf == null && confFile != null) {
conf = new String(IoUtil.read(confFile));
}
MgmtEntry.Certprofile entry = new MgmtEntry.Certprofile(new NameId(null, name), type, conf);
String msg = "certificate profile " + name;
try {
caManager.addCertprofile(entry);
println("added " + msg);
return null;
} catch (CaMgmtException ex) {
throw new CmdFailure("could not add " + msg + ", error: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: org.xipki.shell/ca-mgmt-shell
@Override
protected Object execute0() throws Exception {
if (conf == null && confFile != null) {
conf = new String(IoUtil.read(confFile));
}
MgmtEntry.Publisher entry = new MgmtEntry.Publisher(new NameId(null, name), type, conf);
String msg = "publisher " + name;
try {
caManager.addPublisher(entry);
println("added " + msg);
return null;
} catch (CaMgmtException ex) {
throw new CmdFailure("could not add " + msg + ", error: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: org.xipki.shell/ca-mgmt-shell
@Override
protected Object execute0() throws Exception {
MgmtEntry.Ca caEntry = getCaEntry();
byte[] csr = IoUtil.read(csrFile);
BigInteger serialNumber = null;
if (serialS != null) {
serialNumber = toBigInt(serialS);
}
X509Certificate rootcaCert = caManager.generateRootCa(caEntry, rootcaProfile, csr,
serialNumber);
if (rootcaCertOutFile != null) {
saveVerbose("saved root certificate to file", rootcaCertOutFile,
encodeCert(rootcaCert.getEncoded(), outform));
}
println("generated root CA " + caEntry.getIdent().getName());
return null;
}
代码示例来源:origin: org.xipki.shell/ca-mgmt-shell
@Override
protected Object execute0() throws Exception {
MgmtEntry.Ca ca = caManager.getCa(caName);
if (ca == null) {
throw new CmdFailure("CA " + caName + " not available");
}
Date notBefore = StringUtil.isNotBlank(notBeforeS)
? DateUtil.parseUtcTimeyyyyMMddhhmmss(notBeforeS) : null;
Date notAfter = StringUtil.isNotBlank(notAfterS)
? DateUtil.parseUtcTimeyyyyMMddhhmmss(notAfterS) : null;
byte[] encodedCsr = IoUtil.read(csrFile);
X509Certificate cert = caManager.generateCertificate(caName, profileName, encodedCsr,
notBefore, notAfter);
saveVerbose("saved certificate to file", outFile, encodeCert(cert.getEncoded(), outform));
return null;
}
内容来源于网络,如有侵权,请联系作者删除!