-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INJICERT-585] add support for raw signature
* adds support for algos such as Ed25519Signature2020 Signed-off-by: Harsh Vardhan <[email protected]>
- Loading branch information
Showing
12 changed files
with
187 additions
and
23 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
30 changes: 30 additions & 0 deletions
30
...ice/src/main/java/io/mosip/kernel/keymanagerservice/exception/InvalidFormatException.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,30 @@ | ||
package io.mosip.kernel.keymanagerservice.exception; | ||
|
||
import io.mosip.kernel.core.exception.BaseUncheckedException; | ||
|
||
/** | ||
* Custom Exception Class in case of invalid signature format | ||
* | ||
* @author Harsh Vardhan | ||
* // TODO: which version will this changeset go? | ||
* @since 1.3.x | ||
* | ||
*/ | ||
public class InvalidFormatException extends BaseUncheckedException { | ||
|
||
/** | ||
* Generated serial version id | ||
*/ | ||
private static final long serialVersionUID = 8621530697947108811L; | ||
|
||
/** | ||
* Constructor the initialize Handler exception | ||
* | ||
* @param errorCode The errorcode for this exception | ||
* @param errorMessage The error message for this exception | ||
*/ | ||
public InvalidFormatException(String errorCode, String errorMessage) { | ||
super(errorCode, errorMessage); | ||
} | ||
|
||
} |
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
48 changes: 48 additions & 0 deletions
48
...rnel-keymanager-service/src/main/java/io/mosip/kernel/signature/dto/SignRequestDtoV2.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,48 @@ | ||
package io.mosip.kernel.signature.dto; | ||
|
||
import io.swagger.annotations.ApiModelProperty; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* | ||
* @author Mahammed Taheer | ||
* @since 1.2.0-SNAPSHOT | ||
* | ||
*/ | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class SignRequestDtoV2 { | ||
|
||
@NotBlank | ||
@ApiModelProperty(notes = "Base64 encoded JSON Data to sign", example = "ewogICAiYW55S2V5IjogIlRlc3QgSnNvbiIKfQ", required = true) | ||
private String dataToSign; | ||
|
||
/** | ||
* Application id of decrypting module | ||
*/ | ||
@ApiModelProperty(notes = "Application id to be used for signing", example = "KERNEL", required = false) | ||
private String applicationId; | ||
|
||
/** | ||
* Refrence Id | ||
*/ | ||
@ApiModelProperty(notes = "Refrence Id", example = "SIGN", required = false) | ||
private String referenceId; | ||
|
||
|
||
@ApiModelProperty(notes = "Encoding format of the signature: base64url, base58btc") | ||
private String responseEncodingFormat; | ||
|
||
/** | ||
* Algorithm to use for data signing. Current supported Algorithm [PS256,...] | ||
*/ | ||
@ApiModelProperty(notes = "Algorithm to use for data signing. Current supported Algorithm PS256.", required = false) | ||
// get algo names from rfc7518, except `none` | ||
private String signAlgorithm; | ||
|
||
} |
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
14 changes: 14 additions & 0 deletions
14
...eymanager-service/src/main/java/io/mosip/kernel/signature/service/SignatureServicev2.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,14 @@ | ||
package io.mosip.kernel.signature.service; | ||
|
||
import io.mosip.kernel.signature.dto.*; | ||
|
||
public interface SignatureServicev2 extends SignatureService { | ||
/** | ||
* JSON Web Signature(JWS) for the input data using input algorithm | ||
* | ||
* @param signatureReq | ||
* @return the {@link SignResponseDto} | ||
*/ | ||
public SignResponseDto signv2(SignRequestDtoV2 signatureReq); | ||
|
||
} |
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