-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #699 from eclipse-passage/572366-2
Bug 572366 verify product's public key on hc-fls interaction
- Loading branch information
Showing
41 changed files
with
544 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
bundles/org.eclipse.passage.lbc.base/.settings/.api_filters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...g.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/EncodedResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 ArSysOp | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* https://www.eclipse.org/legal/epl-2.0/. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* ArSysOp - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.passage.lbc.internal.base; | ||
|
||
import java.util.Optional; | ||
|
||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.passage.lbc.internal.base.api.FlsGear; | ||
import org.eclipse.passage.lbc.internal.base.api.FlsGearAwre; | ||
import org.eclipse.passage.lbc.internal.base.api.RawRequest; | ||
import org.eclipse.passage.lic.internal.api.io.Hashes; | ||
import org.eclipse.passage.lic.internal.api.io.KeyKeeper; | ||
import org.eclipse.passage.lic.internal.api.registry.StringServiceId; | ||
import org.eclipse.passage.lic.internal.net.api.handle.NetResponse; | ||
import org.eclipse.passage.lic.internal.net.handle.EObjectTransfer; | ||
import org.eclipse.passage.lic.internal.net.handle.Failure; | ||
import org.eclipse.passage.lic.internal.net.handle.ProductUserRequest; | ||
|
||
public final class EncodedResponse<T extends EObject> { | ||
|
||
private final T payload; | ||
private final ProductUserRequest<RawRequest> data; | ||
|
||
public EncodedResponse(T payload, ProductUserRequest<RawRequest> data) { | ||
this.payload = payload; | ||
this.data = data; | ||
} | ||
|
||
public NetResponse get() { | ||
return new FlsGearAwre()// | ||
.withGear(this::transferable) // | ||
.orElse(new Failure.OperationFailed("mine", "Failed exploiting gear")); //$NON-NLS-1$ //$NON-NLS-2$ | ||
} | ||
|
||
private Optional<NetResponse> transferable(FlsGear gear) { | ||
return Optional.of(new EObjectTransfer(payload, keyKeeper(gear), hashes(gear))); | ||
} | ||
|
||
private KeyKeeper keyKeeper(FlsGear gear) { | ||
return gear.keyKeper(data.product().get(), data.raw().state()::source); | ||
} | ||
|
||
private Hashes hashes(FlsGear gear) { | ||
return gear.hashes().get().service(new StringServiceId(data.algorithm().get())); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.