Skip to content

Commit

Permalink
Ondemand changes move from develop to 1.2.0.2
Browse files Browse the repository at this point in the history
Signed-off-by: Neha Farheen <[email protected]>
  • Loading branch information
Neha Farheen committed Mar 15, 2024
1 parent 07528cd commit 596dfca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,12 @@ public Tuple3<String, String, String> encryptData(byte[] data, String partnerCer
return Tuples.of(CryptoUtil.encodeBase64Url(encryptedData.getT1()), CryptoUtil.encodeBase64Url(encryptedData.getT2()), digestAsPlainText(certificateThumbprint));
}

public byte[] asymmetricEncryption(byte[] dataToEncrypt, String partnerCertificate)
public String asymmetricEncryption(byte[] dataToEncrypt, String partnerCertificate)
throws IdAuthenticationBusinessException {
X509Certificate x509Certificate = getX509Certificate(partnerCertificate);
PublicKey publicKey = x509Certificate.getPublicKey();
byte[] encryptedData = cryptoCore.asymmetricEncrypt(publicKey, dataToEncrypt);
return encryptedData;
return CryptoUtil.encodeBase64(encryptedData);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ private void sendEvents(BaseRequestDTO baserequestdto, String headerSignature, O
eventData.put(REQUESTDATETIME, DateUtils.formatToISOString(DateUtils.getUTCCurrentDateTime()));
eventData.put(INDIVIDUAL_ID,
encryptIndividualId(baserequestdto.getIndividualId(), partnerDataCert.get().getCertificateData()));
eventData.put(AUTH_PARTNER_ID, partner.get().getPartnerId());
eventData.put(AUTH_PARTNER_ID, partner.map(PartnerDTO::getPartnerId).orElse(null));
eventData.put(INDIVIDUAL_ID_TYPE, baserequestdto.getIndividualIdType());
eventData.put(ENTITY_NAME, partner.get().getPartnerName());
eventData.put(ENTITY_NAME, partner.map(PartnerDTO::getPartnerName).orElse(null));
eventData.put(REQUEST_SIGNATURE, headerSignature);
EventModel eventModel = createEventModel(onDemadTemplateExtractionTopic, eventData);
publishEvent(eventModel);
Expand All @@ -158,7 +158,7 @@ private EventModel createEventModel(String topic, Map<String, Object> eventData)
return model;
}

private byte[] encryptIndividualId(String id, String partnerCertificate) {
private String encryptIndividualId(String id, String partnerCertificate) {
try {
logger.info("Inside the method of encryptIndividualId using partner certificate ");
return securityManager.asymmetricEncryption(id.getBytes(), partnerCertificate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ public OtpResponseDTO generateOTP(@Valid @RequestBody OtpRequestDTO otpRequestDt
.createAndSetAuthTxnBuilderMetadataToRequest(otpRequestDto, !isPartnerReq, partner);

try {
String idvidHash = securityManager.hash(otpRequestDto.getIndividualId());
String idType = Objects.nonNull(otpRequestDto.getIndividualIdType()) ? otpRequestDto.getIndividualIdType()
: idTypeUtil.getIdType(otpRequestDto.getIndividualId()).getType();
otpRequestDto.setIndividualIdType(idType);
String idvidHash = securityManager.hash(otpRequestDto.getIndividualId());
otpRequestValidator.validateIdvId(otpRequestDto.getIndividualId(), idType, errors, IdAuthCommonConstants.IDV_ID);
DataValidationUtil.validate(errors);
OtpResponseDTO otpResponseDTO = otpService.generateOtp(otpRequestDto, partnerId, requestWithMetadata);
Expand Down Expand Up @@ -178,4 +178,4 @@ public OtpResponseDTO generateOTP(@Valid @RequestBody OtpRequestDTO otpRequestDt
}
}

}
}

0 comments on commit 596dfca

Please sign in to comment.