Skip to content

Commit

Permalink
[INJICERT-657] fixup duplicate hashing for RSA
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>
  • Loading branch information
vharsh committed Dec 20, 2024
1 parent fe7ab48 commit 78a1805
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import io.mosip.kernel.signature.dto.SignResponseDto;
import io.mosip.kernel.signature.service.SignatureServicev2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Map;

@Component
Expand All @@ -37,9 +35,8 @@ public Canonicalizer getCanonicalizer() {

@Override
public LdProof generateProof(LdProof vcLdProof, String vcEncodedHash, Map<String, String> keyID) {
String vcEncodedData = Base64.getUrlEncoder().encodeToString(vcEncodedHash.getBytes(StandardCharsets.UTF_8));
JWSSignatureRequestDto payload = new JWSSignatureRequestDto();
payload.setDataToSign(vcEncodedData);
payload.setDataToSign(vcEncodedHash);
payload.setApplicationId(keyID.get(Constants.APPLICATION_ID));
payload.setReferenceId(keyID.get(Constants.REFERENCE_ID)); // alg, empty = RSA
payload.setIncludePayload(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mosip.certify.key-values={\
'format': 'ldp_vc',\
'scope' : 'farmer_vc_ldp',\
'cryptographic_binding_methods_supported': {'did:jwk'},\
'cryptographic_suites_supported': {'RsaSignature2018'},\
'cryptographic_suites_supported': {'Ed25519Signature2020'},\
'proof_types_supported': {'jwt'},\
'credential_definition': {\
'type': {'VerifiableCredential','FarmerCredential'},\
Expand Down Expand Up @@ -70,7 +70,7 @@ mosip.certify.key-values={\
'format': 'ldp_vc',\
'scope' : 'mock_identity_vc_ldp',\
'cryptographic_binding_methods_supported': {'did:jwk'},\
'credential_signing_alg_values_supported': {'RsaSignature2018'},\
'credential_signing_alg_values_supported': {'Ed25519Signature2020'},\
'proof_types_supported': {'jwt': {'proof_signing_alg_values_supported': {'RS256', 'PS256'}}},\
'credential_definition': {\
'type': {'VerifiableCredential','FarmerCredential'},\
Expand Down

0 comments on commit 78a1805

Please sign in to comment.