-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added KEYS-V2 allowing to upload private key entries (#4917)
* feat: Added KEYS-V2 allowing to upload private key entries Signed-off-by: Nicola Timeus <[email protected]> * Added support for updating existng entry certificate chain Signed-off-by: Nicola Timeus <[email protected]> --------- Signed-off-by: Nicola Timeus <[email protected]>
- Loading branch information
1 parent
fa92595
commit 21f5f5c
Showing
26 changed files
with
995 additions
and
352 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
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
21 changes: 21 additions & 0 deletions
21
...tore/OSGI-INF/org.eclipse.kura.core.keystore.request.handler.keystoreRequestHandlerV2.xml
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,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2023 Eurotech and/or its affiliates and others | ||
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: | ||
Eurotech | ||
--> | ||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" deactivate="deactivate" enabled="true" immediate="true" name="org.eclipse.kura.core.keystore.request.handler.KeystoreRequestHandlerV2"> | ||
<implementation class="org.eclipse.kura.core.keystore.request.handler.KeystoreServiceRequestHandlerV2"/> | ||
|
||
<property name="service.pid" value="org.eclipse.kura.core.keystore.request.handler.KeystoreServiceRequestHandlerV2"/> | ||
<reference bind="setRequestHandlerRegistry" cardinality="0..n" interface="org.eclipse.kura.cloudconnection.request.RequestHandlerRegistry" name="RequestHandlerRegistry" policy="dynamic" unbind="unsetRequestHandlerRegistry"/> | ||
</scr:component> |
24 changes: 24 additions & 0 deletions
24
....keystore/OSGI-INF/org.eclipse.kura.core.keystore.rest.provider.keystoreRestServiceV1.xml
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,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2021, 2023 Eurotech and/or its affiliates and others | ||
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: | ||
Eurotech | ||
--> | ||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" deactivate="deactivate" enabled="true" immediate="true" name="org.eclipse.kura.core.keystore.rest.provider.KeystoreRestServiceV1"> | ||
<implementation class="org.eclipse.kura.core.keystore.rest.provider.KeystoreRestServiceV1"/> | ||
|
||
<property name="service.pid" value="org.eclipse.kura.core.keystore.rest.provider.KeystoreRestServiceV1"/> | ||
<reference bind="setUserAdmin" cardinality="1..1" interface="org.osgi.service.useradmin.UserAdmin" name="UserAdmin" policy="static"/> | ||
<service> | ||
<provide interface="org.eclipse.kura.core.keystore.rest.provider.KeystoreRestService"/> | ||
</service> | ||
</scr:component> |
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
43 changes: 43 additions & 0 deletions
43
...ra.core.keystore/src/main/java/org/eclipse/kura/core/keystore/request/CsrReadRequest.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,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021, 2023 Eurotech and/or its affiliates and others | ||
* | ||
* 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: | ||
* Eurotech | ||
*******************************************************************************/ | ||
package org.eclipse.kura.core.keystore.request; | ||
|
||
import org.eclipse.kura.core.keystore.util.CsrInfo; | ||
import org.eclipse.kura.rest.utils.Validable; | ||
|
||
public class CsrReadRequest extends CsrInfo implements Validable { | ||
|
||
public CsrReadRequest(String keystoreServicePid, String alias) { | ||
super(keystoreServicePid, alias); | ||
} | ||
|
||
public CsrReadRequest(final CsrInfo csrInfo) { | ||
super(csrInfo.getKeystoreServicePid(), csrInfo.getAlias()); | ||
this.setSignatureAlgorithm(csrInfo.getSignatureAlgorithm()); | ||
this.setAttributes(csrInfo.getAttributes()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ReadRequest [keystoreServicePid=" + this.getKeystoreServicePid() + ", alias=" + this.getAlias() | ||
+ ", algorithm=" | ||
+ this.getSignatureAlgorithm() + ", attributes=" + this.getAttributes() + "]"; | ||
} | ||
|
||
@Override | ||
public boolean isValid() { | ||
return this.getKeystoreServicePid() != null && this.getAlias() != null && this.getSignatureAlgorithm() != null | ||
&& this.getAttributes() != null; | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...kura.core.keystore/src/main/java/org/eclipse/kura/core/keystore/request/EntryRequest.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,38 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021, 2023 Eurotech and/or its affiliates and others | ||
* | ||
* 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: | ||
* Eurotech | ||
*******************************************************************************/ | ||
package org.eclipse.kura.core.keystore.request; | ||
|
||
import org.eclipse.kura.core.keystore.util.EntryInfo; | ||
import org.eclipse.kura.rest.utils.Validable; | ||
|
||
public class EntryRequest extends EntryInfo implements Validable { | ||
|
||
public EntryRequest(String keystoreServicePid, String alias) { | ||
super(keystoreServicePid, alias); | ||
} | ||
|
||
public EntryRequest(final EntryInfo entryInfo) { | ||
super(entryInfo.getKeystoreServicePid(), entryInfo.getAlias()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DeleteRequest [keystoreServicePid=" + this.getKeystoreServicePid() + ", alias=" + this.getAlias() + "]"; | ||
} | ||
|
||
@Override | ||
public boolean isValid() { | ||
return this.getKeystoreServicePid() != null && this.getAlias() != null; | ||
} | ||
|
||
} |
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
37 changes: 37 additions & 0 deletions
37
...keystore/src/main/java/org/eclipse/kura/core/keystore/request/PrivateKeyWriteRequest.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,37 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Eurotech and/or its affiliates and others | ||
* | ||
* 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: | ||
* Eurotech | ||
*******************************************************************************/ | ||
package org.eclipse.kura.core.keystore.request; | ||
|
||
import org.eclipse.kura.core.keystore.util.PrivateKeyInfo; | ||
import org.eclipse.kura.rest.utils.Validable; | ||
|
||
public class PrivateKeyWriteRequest extends PrivateKeyInfo implements Validable { | ||
|
||
public PrivateKeyWriteRequest(String keystoreServicePid, String alias) { | ||
super(keystoreServicePid, alias); | ||
} | ||
|
||
public PrivateKeyWriteRequest(final PrivateKeyInfo other) { | ||
super(other.getAlias(), other.getKeystoreServicePid()); | ||
this.setAlgorithm(other.getAlgorithm()); | ||
this.setSize(other.getSize()); | ||
this.setPrivateKey(other.getPrivateKey()); | ||
this.setCertificateChain(other.getCertificateChain()); | ||
} | ||
|
||
@Override | ||
public boolean isValid() { | ||
return getKeystoreServicePid() != null && getAlias() != null && getCertificateChain() != null | ||
&& getCertificateChain().length > 0; | ||
} | ||
} |
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.