summaryrefslogtreecommitdiffstats
path: root/bcpkix/src/main/java/org/bouncycastle/cert/path/CertPathValidationContext.java
blob: 6a4b0ec27fabb22c16ce70cf92a232fe89bd9c91 (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
package org.bouncycastle.cert.path;

import java.util.HashSet;
import java.util.Set;

import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.util.Memoable;

public class CertPathValidationContext
    implements Memoable
{
    private Set criticalExtensions;

    private Set handledExtensions = new HashSet();
    private boolean endEntity;
    private int index;

    public CertPathValidationContext(Set criticalExtensionsOIDs)
    {
        this.criticalExtensions = criticalExtensionsOIDs;
    }

    public void addHandledExtension(ASN1ObjectIdentifier extensionIdentifier)
    {
        this.handledExtensions.add(extensionIdentifier);
    }

    public void setIsEndEntity(boolean isEndEntity)
    {
        this.endEntity = isEndEntity;
    }

    public Set getUnhandledCriticalExtensionOIDs()
    {
        Set rv = new HashSet(criticalExtensions);

        rv.removeAll(handledExtensions);

        return rv;
    }

    /**
     * Returns true if the current certificate is the end-entity certificate.
     *
     * @return if current cert end-entity, false otherwise.
     */
    public boolean isEndEntity()
    {
        return endEntity;
    }

    public Memoable copy()
    {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public void reset(Memoable other)
    {
        //To change body of implemented methods use File | Settings | File Templates.
    }
}