本文整理匯總了Java中co.nstant.in.cbor.CborBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java CborBuilder類的具體用法?Java CborBuilder怎麽用?Java CborBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CborBuilder類屬於co.nstant.in.cbor包,在下文中一共展示了CborBuilder類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: encode
import co.nstant.in.cbor.CborBuilder; //導入依賴的package包/類
@Override
public byte[] encode() throws CborException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
List<DataItem> dataItems =
new CborBuilder().addMap().put(new UnsignedInteger(KTY_LABEL), new UnsignedInteger(kty))
.put(new UnsignedInteger(ALG_LABEL), new NegativeInteger(alg.encodeToInt()))
.put(new NegativeInteger(N_LABEL), new ByteString(n))
.put(new NegativeInteger(E_LABEL), new ByteString(e)).end().build();
new CborEncoder(output).encode(dataItems);
return output.toByteArray();
}
示例2: encode
import co.nstant.in.cbor.CborBuilder; //導入依賴的package包/類
@Override
public byte[] encode() throws CborException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
List<DataItem> dataItems =
new CborBuilder().addMap().put(new UnsignedInteger(KTY_LABEL), new UnsignedInteger(kty))
.put(new UnsignedInteger(ALG_LABEL), new NegativeInteger(alg.encodeToInt()))
.put(new NegativeInteger(CRV_LABEL), new UnsignedInteger(crv))
.put(new NegativeInteger(X_LABEL), new ByteString(x))
.put(new NegativeInteger(Y_LABEL), new ByteString(y)).end().build();
new CborEncoder(output).encode(dataItems);
return output.toByteArray();
}
示例3: encode
import co.nstant.in.cbor.CborBuilder; //導入依賴的package包/類
/**
* @return Encoded byte array containing AttestationObject data
* @throws CborException
*/
public byte[] encode() throws CborException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
List<DataItem> cbor =
new CborBuilder().addMap().put("fmt", fmt).put("authData", authData.encode())
.put(new UnicodeString("attStmt"), attStmt.encode()).end().build();
new CborEncoder(output).encode(cbor);
return output.toByteArray();
}