本文整理汇总了Java中org.bouncycastle.crypto.tls.Certificate.parse方法的典型用法代码示例。如果您正苦于以下问题:Java Certificate.parse方法的具体用法?Java Certificate.parse怎么用?Java Certificate.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.crypto.tls.Certificate
的用法示例。
在下文中一共展示了Certificate.parse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unmarshal
import org.bouncycastle.crypto.tls.Certificate; //导入方法依赖的package包/类
@Override
public Certificate unmarshal(String v) throws Exception {
Certificate cert = Certificate.parse(new ByteArrayInputStream(ArrayConverter.hexStringToByteArray(v.replaceAll(
"\\s+", ""))));
return cert;
}
示例2: parseCertificate
import org.bouncycastle.crypto.tls.Certificate; //导入方法依赖的package包/类
private Certificate parseCertificate(int lengthBytes, byte[] bytesToParse) {
try {
ByteArrayInputStream stream = new ByteArrayInputStream(ArrayConverter.concatenate(
ArrayConverter.intToBytes(lengthBytes, HandshakeByteLength.CERTIFICATES_LENGTH), bytesToParse));
return Certificate.parse(stream);
} catch (IOException | IllegalArgumentException E) {
LOGGER.warn("Could not parse Certificate bytes into Certificate object:"
+ ArrayConverter.bytesToHexString(bytesToParse, false));
LOGGER.debug(E);
return null;
}
}
示例3: getTestCertificate
import org.bouncycastle.crypto.tls.Certificate; //导入方法依赖的package包/类
public static Certificate getTestCertificate() {
try {
ByteArrayInputStream bin = new ByteArrayInputStream(cert1);
ASN1InputStream ain = new ASN1InputStream(bin);
Certificate obj = Certificate.parse(ain);
return obj;
} catch (IOException ex) {
ex.printStackTrace();
}
return null;
}
示例4: parseCertificate
import org.bouncycastle.crypto.tls.Certificate; //导入方法依赖的package包/类
private Certificate parseCertificate(int lengthBytes, byte[] bytesToParse) {
try {
ByteArrayInputStream stream = new ByteArrayInputStream(ArrayConverter.concatenate(
ArrayConverter.intToBytes(lengthBytes, HandshakeByteLength.CERTIFICATES_LENGTH), bytesToParse));
return Certificate.parse(stream);
} catch (IOException E) {
LOGGER.warn("Could not parse Certificate bytes into Certificate object:"
+ ArrayConverter.bytesToHexString(bytesToParse, false));
return null;
}
}
示例5: testDefaultCertificates
import org.bouncycastle.crypto.tls.Certificate; //导入方法依赖的package包/类
@Test
public void testDefaultCertificates() throws IOException {
Config config = Config.createConfig();
Certificate cert = Certificate.parse(new ByteArrayInputStream(config.getDefaultRsaCertificate()));
cert = Certificate.parse(new ByteArrayInputStream(config.getDefaultEcCertificate()));
cert = Certificate.parse(new ByteArrayInputStream(config.getDefaultDsaCertificate()));
}
示例6: getCertificate
import org.bouncycastle.crypto.tls.Certificate; //导入方法依赖的package包/类
private Certificate getCertificate(Config config) throws IOException {
return Certificate.parse(new ByteArrayInputStream(CertificateByteChooser.chooseCertificateType(config)));
}