Java Code Examples for java.security.cert.PKIXParameters#getTrustAnchors()

The following examples show how to use java.security.cert.PKIXParameters#getTrustAnchors() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtendedPKIXParameters.java    From RipplePower with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an instance with the parameters of a given
 * <code>PKIXParameters</code> object.
 * 
 * @param pkixParams The given <code>PKIXParameters</code>
 * @return an extended PKIX params object
 */
public static ExtendedPKIXParameters getInstance(PKIXParameters pkixParams)
{
    ExtendedPKIXParameters params;
    try
    {
        params = new ExtendedPKIXParameters(pkixParams.getTrustAnchors());
    }
    catch (Exception e)
    {
        // cannot happen
        throw new RuntimeException(e.getMessage());
    }
    params.setParams(pkixParams);
    return params;
}
 
Example 2
Source File: ExtendedPKIXBuilderParameters.java    From RipplePower with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an instance of <code>ExtendedPKIXParameters</code> which can be
 * safely casted to <code>ExtendedPKIXBuilderParameters</code>.
 * <p>
 * This method can be used to get a copy from other
 * <code>PKIXBuilderParameters</code>, <code>PKIXParameters</code>,
 * and <code>ExtendedPKIXParameters</code> instances.
 * 
 * @param pkixParams The PKIX parameters to create a copy of.
 * @return An <code>ExtendedPKIXBuilderParameters</code> instance.
 */
public static ExtendedPKIXParameters getInstance(PKIXParameters pkixParams)
{
    ExtendedPKIXBuilderParameters params;
    try
    {
        params = new ExtendedPKIXBuilderParameters(pkixParams
                .getTrustAnchors(), X509CertStoreSelector
                .getInstance((X509CertSelector) pkixParams
                        .getTargetCertConstraints()));
    }
    catch (Exception e)
    {
        // cannot happen
        throw new RuntimeException(e.getMessage());
    }
    params.setParams(pkixParams);
    return params;
}
 
Example 3
Source File: ExtendedPKIXParameters.java    From ripple-lib-java with ISC License 6 votes vote down vote up
/**
 * Returns an instance with the parameters of a given
 * <code>PKIXParameters</code> object.
 * 
 * @param pkixParams The given <code>PKIXParameters</code>
 * @return an extended PKIX params object
 */
public static ExtendedPKIXParameters getInstance(PKIXParameters pkixParams)
{
    ExtendedPKIXParameters params;
    try
    {
        params = new ExtendedPKIXParameters(pkixParams.getTrustAnchors());
    }
    catch (Exception e)
    {
        // cannot happen
        throw new RuntimeException(e.getMessage());
    }
    params.setParams(pkixParams);
    return params;
}
 
Example 4
Source File: ExtendedPKIXBuilderParameters.java    From ripple-lib-java with ISC License 6 votes vote down vote up
/**
 * Returns an instance of <code>ExtendedPKIXParameters</code> which can be
 * safely casted to <code>ExtendedPKIXBuilderParameters</code>.
 * <p>
 * This method can be used to get a copy from other
 * <code>PKIXBuilderParameters</code>, <code>PKIXParameters</code>,
 * and <code>ExtendedPKIXParameters</code> instances.
 * 
 * @param pkixParams The PKIX parameters to create a copy of.
 * @return An <code>ExtendedPKIXBuilderParameters</code> instance.
 */
public static ExtendedPKIXParameters getInstance(PKIXParameters pkixParams)
{
    ExtendedPKIXBuilderParameters params;
    try
    {
        params = new ExtendedPKIXBuilderParameters(pkixParams
                .getTrustAnchors(), X509CertStoreSelector
                .getInstance((X509CertSelector) pkixParams
                        .getTargetCertConstraints()));
    }
    catch (Exception e)
    {
        // cannot happen
        throw new RuntimeException(e.getMessage());
    }
    params.setParams(pkixParams);
    return params;
}
 
Example 5
Source File: PKIXExtendedParameters.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
public Builder(PKIXParameters baseParameters)
{
    this.baseParameters = (PKIXParameters)baseParameters.clone();
    CertSelector constraints = baseParameters.getTargetCertConstraints();
    if (constraints != null)
    {
        this.targetConstraints = new PKIXCertStoreSelector.Builder(constraints).build();
    }
    Date checkDate = baseParameters.getDate();
    this.date = (checkDate == null) ? new Date() : checkDate;
    this.revocationEnabled = baseParameters.isRevocationEnabled();
    this.trustAnchors = baseParameters.getTrustAnchors();
}
 
Example 6
Source File: PKIXExtendedParameters.java    From ripple-lib-java with ISC License 5 votes vote down vote up
public Builder(PKIXParameters baseParameters)
{
    this.baseParameters = (PKIXParameters)baseParameters.clone();
    CertSelector constraints = baseParameters.getTargetCertConstraints();
    if (constraints != null)
    {
        this.targetConstraints = new PKIXCertStoreSelector.Builder(constraints).build();
    }
    Date checkDate = baseParameters.getDate();
    this.date = (checkDate == null) ? new Date() : checkDate;
    this.revocationEnabled = baseParameters.isRevocationEnabled();
    this.trustAnchors = baseParameters.getTrustAnchors();
}