File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
sigstore-java/src/main/java/dev/sigstore Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ public interface MessageDigest {
138
138
public interface DsseEnvelope {
139
139
140
140
/** An arbitrary payload that does not need to be parsed to be validated */
141
- String getPayload ();
141
+ byte [] getPayload ();
142
142
143
143
/** Information on how to interpret the payload */
144
144
String getPayloadType ();
@@ -158,12 +158,18 @@ default byte[] getPAE() {
158
158
+ " "
159
159
+ getPayloadType ()
160
160
+ " "
161
- + getPayload ().length ()
161
+ + getPayloadAsString ().length ()
162
162
+ " "
163
- + getPayload ())
163
+ + getPayloadAsString ())
164
164
.getBytes (StandardCharsets .UTF_8 );
165
165
}
166
166
167
+ @ Lazy
168
+ @ Gson .Ignore
169
+ default String getPayloadAsString () {
170
+ return new String (getPayload (), StandardCharsets .UTF_8 );
171
+ }
172
+
167
173
@ Lazy
168
174
@ Gson .Ignore
169
175
default byte [] getSignature () {
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ static Bundle readBundle(Reader jsonReader) throws BundleParseException {
103
103
var dsseEnvelopeProto = protoBundle .getDsseEnvelope ();
104
104
var dsseEnvelopeBuilder =
105
105
ImmutableDsseEnvelope .builder ()
106
- .payload (dsseEnvelopeProto .getPayload ().toStringUtf8 ())
106
+ .payload (dsseEnvelopeProto .getPayload ().toByteArray ())
107
107
.payloadType (dsseEnvelopeProto .getPayloadType ());
108
108
for (int sigIndex = 0 ; sigIndex < dsseEnvelopeProto .getSignaturesCount (); sigIndex ++) {
109
109
dsseEnvelopeBuilder .addSignatures (
Original file line number Diff line number Diff line change @@ -52,6 +52,6 @@ interface Subject {
52
52
}
53
53
54
54
static InTotoPayload from (DsseEnvelope dsseEnvelope ) {
55
- return GSON .get ().fromJson (dsseEnvelope .getPayload (), InTotoPayload .class );
55
+ return GSON .get ().fromJson (dsseEnvelope .getPayloadAsString (), InTotoPayload .class );
56
56
}
57
57
}
You can’t perform that action at this time.
0 commit comments