1<?php
2/*
3 * Copyright 2008-2010 GuardTime AS
4 *
5 * This file is part of the GuardTime PHP SDK.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20/**
21 * @package asn1
22 * @subpackage gt
23 */
24
25/**
26 * GT CertTokenRequest implementation.
27 *
28 * <pre>
29 * CertTokenRequest ::= SEQUENCE {
30 *    version             INTEGER { v1(1) },
31 *    historyIdentifier   INTEGER,
32 *    extensions          [0] Extensions OPTIONAL
33 * }
34 * </pre>
35 *
36 * @package asn1
37 * @subpackage gt
38 */
39class GTCertTokenRequest implements ASN1DEREncodable {
40
41    private $version = 1;
42    private $historyIdentifier;
43
44    /**
45     * Constructs a new instance of GTCertTokenRequest.
46     */
47    public function __construct() {
48    }
49
50    /**
51     * Encodes this GTCertTokenRequest using DER.
52     *
53     * @return array array of bytes that contains the DER encoding of this GTCertTokenRequest
54     */
55    public function encodeDER() {
56
57        $sequence = new ASN1Sequence();
58        $sequence->add(new ASN1Integer($this->version));
59        $sequence->add(new ASN1Integer($this->historyIdentifier));
60
61        return $sequence->encodeDER();
62    }
63
64    /**
65     * Gets the version.
66     *
67     * @return int version
68     */
69    public function getVersion() {
70        return $this->version;
71    }
72
73    /**
74     * Gets the history identifier.
75     *
76     * @return string history identifier
77     */
78    public function getHistoryIdentifier() {
79        return $this->historyIdentifier;
80    }
81
82    /**
83     * Sets the history identifier.
84     *
85     * @param  string $historyIdentifier history identifier
86     * @return void
87     */
88    public function setHistoryIdentifier($historyIdentifier) {
89        $this->historyIdentifier = $historyIdentifier;
90    }
91
92}
93
94?>
95