aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/core/src/main/jdk1.1/java/security/cert/X509CRLEntry.java
blob: bb0d78074b9e55a39b52e3b4b67b951d0fd0c21d (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
package java.security.cert;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.Date;

public abstract class X509CRLEntry implements X509Extension
{
    public boolean equals(Object other)
    {
        if ( this == other )
            return true;

        if ( !(other instanceof X509CRLEntry) )
            return false;

        try
        {
            byte[] enc1 = getEncoded();
            byte[] enc2 = ((X509CRLEntry)other).getEncoded();

            return MessageDigest.isEqual(enc1, enc2);
        }
        catch (CRLException e)
        {
            return false;
        }
    }

    public int hashCode()
    {
        int hashcode = 0;

        try
        {
            byte[] encoded = getEncoded();
            for (int i = 1; i < encoded.length; i++)
            {
                hashcode += encoded[i] * i;
            }
        }
        catch (CRLException ce)
        {
            return(hashcode);
        }

        return(hashcode);
    }

    public abstract byte[] getEncoded() throws CRLException;
    public abstract Date getRevocationDate();
    public abstract BigInteger getSerialNumber();
    public abstract boolean hasExtensions();
    public abstract String toString();
}