aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/pkix/src/main/java/org/spongycastle/dvcs/CPDRequestData.java
blob: a7c1f5a81b4e4856800f777f760266165b56e66d (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
package org.spongycastle.dvcs;

import org.spongycastle.asn1.dvcs.Data;

/**
 * Data piece of DVCRequest for CPD service (Certify Possession of Data).
 * It contains CPD-specific selector interface.
 * <p/>
 * This objects are constructed internally,
 * to build DVCS request to CPD service use CPDRequestBuilder.
 */
public class CPDRequestData
    extends DVCSRequestData
{
    CPDRequestData(Data data)
        throws DVCSConstructionException
    {
        super(data);
        initMessage();
    }

    private void initMessage()
        throws DVCSConstructionException
    {
        if (data.getMessage() == null)
        {
            throw new DVCSConstructionException("DVCSRequest.data.message should be specified for CPD service");
        }
    }

    /**
     * Get contained message (data to be certified).
     *
     * @return
     */
    public byte[] getMessage()
    {
        return data.getMessage().getOctets();
    }
}