-
Notifications
You must be signed in to change notification settings - Fork 177
Expand file tree
/
Copy pathCertifyX509Response.java
More file actions
110 lines (91 loc) · 3.78 KB
/
Copy pathCertifyX509Response.java
File metadata and controls
110 lines (91 loc) · 3.78 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package tss.tpm;
import tss.*;
// -----------This is an auto-generated file: do not edit
//>>>
/** The purpose of this command is to generate an X.509 certificate that proves an object
* with a specific public key and attributes is loaded in the TPM. In contrast to
* TPM2_Certify, which uses a TCG-defined data structure to convey attestation
* information, TPM2_CertifyX509 encodes the attestation information in a DER-encoded
* X.509 certificate that is compliant with RFC5280 Internet X.509 Public Key
* Infrastructure Certificate and Certificate Revocation List (CRL) Profile.
*/
public class CertifyX509Response extends RespStructure
{
/** A DER encoded SEQUENCE containing the DER encoded fields added to partialCertificate
* to make it a complete RFC5280 TBSCertificate.
*/
public byte[] addedToCertificate;
/** The digest that was signed */
public byte[] tbsDigest;
/** Selector of the algorithm used to construct the signature */
public TPM_ALG_ID signatureSigAlg() { return signature != null ? signature.GetUnionSelector() : TPM_ALG_ID.NULL; }
/** The signature over tbsDigest
* One of: TPMS_SIGNATURE_RSASSA, TPMS_SIGNATURE_RSAPSS, TPMS_SIGNATURE_ECDSA,
* TPMS_SIGNATURE_ECDAA, TPMS_SIGNATURE_SM2, TPMS_SIGNATURE_ECSCHNORR, TPMT_HA,
* TPMS_SCHEME_HASH, TPMS_NULL_SIGNATURE.
*/
public TPMU_SIGNATURE signature;
public CertifyX509Response() {}
/** TpmMarshaller method */
@Override
public void toTpm(TpmBuffer buf)
{
buf.writeSizedByteBuf(addedToCertificate);
buf.writeSizedByteBuf(tbsDigest);
buf.writeShort(signature.GetUnionSelector());
signature.toTpm(buf);
}
/** TpmMarshaller method */
@Override
public void initFromTpm(TpmBuffer buf)
{
addedToCertificate = buf.readSizedByteBuf();
tbsDigest = buf.readSizedByteBuf();
TPM_ALG_ID signatureSigAlg = TPM_ALG_ID.fromTpm(buf);
signature = UnionFactory.create("TPMU_SIGNATURE", signatureSigAlg);
signature.initFromTpm(buf);
}
/** @deprecated Use {@link #toBytes()} instead
* @return Wire (marshaled) representation of this object
*/
public byte[] toTpm () { return toBytes(); }
/** Static marshaling helper
* @param byteBuf Wire representation of the object
* @return New object constructed from its wire representation
*/
public static CertifyX509Response fromBytes (byte[] byteBuf)
{
return new TpmBuffer(byteBuf).createObj(CertifyX509Response.class);
}
/** @deprecated Use {@link #fromBytes(byte[])} instead
* @param byteBuf Wire representation of the object
* @return New object constructed from its wire representation
*/
public static CertifyX509Response fromTpm (byte[] byteBuf) { return fromBytes(byteBuf); }
/** Static marshaling helper
* @param buf Wire representation of the object
* @return New object constructed from its wire representation
*/
public static CertifyX509Response fromTpm (TpmBuffer buf)
{
return buf.createObj(CertifyX509Response.class);
}
@Override
public String toString()
{
TpmStructurePrinter _p = new TpmStructurePrinter("CertifyX509Response");
toStringInternal(_p, 1);
_p.endStruct();
return _p.toString();
}
@Override
public void toStringInternal(TpmStructurePrinter _p, int d)
{
_p.add(d, "byte[]", "addedToCertificate", addedToCertificate);
_p.add(d, "byte[]", "tbsDigest", tbsDigest);
_p.add(d, "TPMU_SIGNATURE", "signature", signature);
}
@Override
public SessEncInfo sessEncInfo() { return new SessEncInfo(2, 1); }
}
//<<<