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

TlsTestConfig.java « test « tls « crypto « bouncycastle « org « java « test « src « core - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6110458ebae89ef236460b1c52801c46d55a1b70 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package org.bouncycastle.crypto.tls.test;

import org.bouncycastle.crypto.tls.ConnectionEnd;
import org.bouncycastle.crypto.tls.ProtocolVersion;

public class TlsTestConfig
{
    public static final boolean DEBUG = false;

    /**
     * Client does not authenticate, ignores any certificate request
     */
    public static final int CLIENT_AUTH_NONE = 0;

    /**
     * Client will authenticate if it receives a certificate request
     */
    public static final int CLIENT_AUTH_VALID = 1;

    /**
     * Client will authenticate if it receives a certificate request, with an invalid certificate
     */
    public static final int CLIENT_AUTH_INVALID_CERT = 2;

    /**
     * Client will authenticate if it receives a certificate request, with an invalid CertificateVerify signature
     */
    public static final int CLIENT_AUTH_INVALID_VERIFY = 3;

    /**
     * Server will not request a client certificate
     */
    public static final int SERVER_CERT_REQ_NONE = 0;

    /**
     * Server will request a client certificate but receiving one is optional
     */
    public static final int SERVER_CERT_REQ_OPTIONAL = 1;

    /**
     * Server will request a client certificate and receiving one is mandatory
     */
    public static final int SERVER_CERT_REQ_MANDATORY = 2;

    /**
     * Configures the client authentication behaviour of the test client. Use CLIENT_AUTH_* constants.
     */
    public int clientAuth = CLIENT_AUTH_VALID;

    /**
     * Configures the minimum protocol version the client will accept. If null, uses the library's default.
     */
    public ProtocolVersion clientMinimumVersion = null;

    /**
     * Configures the protocol version the client will offer. If null, uses the library's default.
     */
    public ProtocolVersion clientOfferVersion = null;

    /**
     * Configures whether the test server will send a certificate request.
     */
    public int serverCertReq = SERVER_CERT_REQ_OPTIONAL;

    /**
     * Configures the maximum protocol version the server will accept. If null, uses the library's default.
     */
    public ProtocolVersion serverMaximumVersion = null;

    /**
     * Configures the minimum protocol version the server will accept. If null, uses the library's default.
     */
    public ProtocolVersion serverMinimumVersion = null;

    /**
     * Configures the connection end that a fatal alert is expected to be raised. Use ConnectionEnd.* constants.
     */
    public int expectFatalAlertConnectionEnd = -1;

    /**
     * Configures the type of fatal alert expected to be raised. Use AlertDescription.* constants.
     */
    public short expectFatalAlertDescription = -1;

    public void expectClientFatalAlert(short alertDescription)
    {
        this.expectFatalAlertConnectionEnd = ConnectionEnd.client;
        this.expectFatalAlertDescription = alertDescription;
    }

    public void expectServerFatalAlert(short alertDescription)
    {
        this.expectFatalAlertConnectionEnd = ConnectionEnd.server;
        this.expectFatalAlertDescription = alertDescription;
    }
}