Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CertPathValidationResult.java « path « cert « spongycastle « org « java « main « src « pkix - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 276ef8d48b6a68d1aca4bd997447e07df0c38a39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package org.spongycastle.cert.path;

import java.util.Collections;
import java.util.Set;

public class CertPathValidationResult
{
    private final boolean isValid;
    private final CertPathValidationException cause;
    private final Set unhandledCriticalExtensionOIDs;

    private int[] certIndexes;

    public CertPathValidationResult(CertPathValidationContext context)
    {
        this.unhandledCriticalExtensionOIDs = Collections.unmodifiableSet(context.getUnhandledCriticalExtensionOIDs());
        this.isValid = this.unhandledCriticalExtensionOIDs.isEmpty();
        cause = null;
    }

    public CertPathValidationResult(CertPathValidationContext context, int certIndex, int ruleIndex, CertPathValidationException cause)
    {
        this.unhandledCriticalExtensionOIDs = Collections.unmodifiableSet(context.getUnhandledCriticalExtensionOIDs());
        this.isValid = false;
        this.cause = cause;
    }

    public CertPathValidationResult(CertPathValidationContext context, int[] certIndexes, int[] ruleIndexes, CertPathValidationException[] cause)
    {
        // TODO
        this.unhandledCriticalExtensionOIDs = Collections.unmodifiableSet(context.getUnhandledCriticalExtensionOIDs());
        this.isValid = false;
        this.cause = cause[0];
        this.certIndexes = certIndexes;
    }

    public boolean isValid()
    {
        return isValid;
    }

    public Exception getCause()
    {
        if (cause != null)
        {
            return cause;
        }

        if (!unhandledCriticalExtensionOIDs.isEmpty())
        {
            return new CertPathValidationException("Unhandled Critical Extensions");
        }

        return null;
    }

    public Set getUnhandledCriticalExtensionOIDs()
    {
        return unhandledCriticalExtensionOIDs;
    }

    public boolean isDetailed()
    {
        return this.certIndexes != null;
    }
}