本文整理汇总了Java中sun.security.provider.certpath.X509CertPath类的典型用法代码示例。如果您正苦于以下问题:Java X509CertPath类的具体用法?Java X509CertPath怎么用?Java X509CertPath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
X509CertPath类属于sun.security.provider.certpath包,在下文中一共展示了X509CertPath类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: engineGenerateCertPath
import sun.security.provider.certpath.X509CertPath; //导入依赖的package包/类
/**
* Generates a <code>CertPath</code> object and initializes it with
* the data read from the <code>InputStream</code> inStream. The data
* is assumed to be in the default encoding.
*
* @param inStream an <code>InputStream</code> containing the data
* @return a <code>CertPath</code> initialized with the data from the
* <code>InputStream</code>
* @exception CertificateException if an exception occurs while decoding
* @since 1.4
*/
@Override
public CertPath engineGenerateCertPath(InputStream inStream)
throws CertificateException
{
if (inStream == null) {
throw new CertificateException("Missing input stream");
}
try {
byte[] encoding = readOneBlock(inStream);
if (encoding != null) {
return new X509CertPath(new ByteArrayInputStream(encoding));
} else {
throw new IOException("Empty input");
}
} catch (IOException ioe) {
throw new CertificateException(ioe.getMessage());
}
}
示例2: main
import sun.security.provider.certpath.X509CertPath; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
List certs = new Vector();
certs.add("The 1st certificate");
certs.add("The 2nd certificate");
certs.add("The 3rd certificate");
certs.add("The 4th certificate");
try {
X509CertPath cp = new X509CertPath(certs);
throw new Exception("No expected CertificateException thrown");
} catch (CertificateException ce) {
// get the expected exception
} catch (Exception e) {
throw new Exception("No expected CertificateException thrown", e);
}
}
示例3: engineGenerateCertPath
import sun.security.provider.certpath.X509CertPath; //导入依赖的package包/类
/**
* Generates a <code>CertPath</code> object and initializes it with
* the data read from the <code>InputStream</code> inStream. The data
* is assumed to be in the default encoding.
*
* @param inStream an <code>InputStream</code> containing the data
* @return a <code>CertPath</code> initialized with the data from the
* <code>InputStream</code>
* @exception CertificateException if an exception occurs while decoding
* @since 1.4
*/
public CertPath engineGenerateCertPath(InputStream inStream)
throws CertificateException
{
if (inStream == null) {
throw new CertificateException("Missing input stream");
}
try {
byte[] encoding = readOneBlock(inStream);
if (encoding != null) {
return new X509CertPath(new ByteArrayInputStream(encoding));
} else {
throw new IOException("Empty input");
}
} catch (IOException ioe) {
throw new CertificateException(ioe.getMessage());
}
}
示例4: createNotifyFailureMessage
import sun.security.provider.certpath.X509CertPath; //导入依赖的package包/类
private Message createNotifyFailureMessage(Interest interest) {
ObjectDeployment interested = interest.getInterested();
Message message =
new Message(interested.getModule().getContainerID(), interested.getDeploymentID(),
interest.getFailureNotificationMethod().getName());
DeploymentID stubDeploymentID =
interestProcessor.getModule().getStubDeploymentID(interest.getStubServiceID());
Class<?> stubType = interest.getFailureNotificationMethod().getParameterTypes()[0];
StubParameter stubParameter = new StubParameter(stubDeploymentID);
message.addParameter(stubType, stubParameter);
if (interest.hasFailureNotificationMethodDeploymentID()) {
message.addParameter(DeploymentID.class, stubDeploymentID);
}
if (interest.hasFailureNotificationMethodCertificate()) {
message.addParameter(X509CertPath.class, interest.getInterestCertPath());
}
return message;
}