in java/cose/CoseEllipticCurveKey.java [66:78]
public static CoseEllipticCurveKey decode(byte[] data) throws CborException {
DataItem coseEcKey = CborUtil.cborToDataItem(data);
Map keyMap = CborUtil.asMap(coseEcKey);
byte[] x = CborUtil.asByteString(keyMap.get(new NegativeInteger(COSE_EC_KEY_X_KEY))).getBytes();
if (keyMap.get(new NegativeInteger(COSE_EC_KEY_D_KEY)) == null) {
return new CoseEllipticCurveKey(x, Optional.empty());
}
return new CoseEllipticCurveKey(
x,
Optional.of(
CborUtil.asByteString(keyMap.get(new NegativeInteger(COSE_EC_KEY_D_KEY))).getBytes()));
}