Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosip 31361 #12

Open
wants to merge 11 commits into
base: develop_07092020
Choose a base branch
from
32 changes: 32 additions & 0 deletions db_scripts/mosip_reg/ddl/reg-key_alias.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- -------------------------------------------------------------------------------------------------
-- Database Name: mosip_reg
-- Table Name : reg.key_alias
-- Purpose : Key Alias: To maintain a system generated key as alias for the encryption key that will be stored in key-store devices like HSM.
--
-- Create By : Sadanandegowda DM
-- Created Date : Sep-2020
--
-- Modified Date Modified By Comments / Remarks
-- ------------------------------------------------------------------------------------------
--
-- ------------------------------------------------------------------------------------------

-- object: reg.key_alias | type: TABLE --
-- DROP TABLE IF EXISTS reg.key_alias CASCADE;
CREATE TABLE reg.key_alias(
id character varying(36) NOT NULL,
app_id character varying(36) NOT NULL,
ref_id character varying(128),
key_gen_dtimes timestamp,
key_expire_dtimes timestamp,
status_code character varying(36),
lang_code character varying(3),
cr_by character varying(256) NOT NULL,
cr_dtimes timestamp NOT NULL,
upd_by character varying(256),
upd_dtimes timestamp,
is_deleted boolean,
del_dtimes timestamp,
CONSTRAINT pk_keymals_id PRIMARY KEY (id)

);
28 changes: 28 additions & 0 deletions db_scripts/mosip_reg/ddl/reg-key_policy_def.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- -------------------------------------------------------------------------------------------------
-- Database Name: mosip_reg
-- Table Name : reg.key_policy_def
-- Purpose : Key Policy Defination: Policy related to encryption key management is defined here. For eg. Expiry duration of a key generated.
--
-- Create By : Sadanandegowda DM
-- Created Date : Sep-2020
--
-- Modified Date Modified By Comments / Remarks
-- ------------------------------------------------------------------------------------------
--
-- ------------------------------------------------------------------------------------------

-- object: reg.key_policy_def | type: TABLE --
-- DROP TABLE IF EXISTS reg.key_policy_def CASCADE;
CREATE TABLE reg.key_policy_def(
app_id character varying(36) NOT NULL,
key_validity_duration smallint,
is_active boolean NOT NULL,
cr_by character varying(256) NOT NULL,
cr_dtimes timestamp NOT NULL,
upd_by character varying(256),
upd_dtimes timestamp,
is_deleted boolean,
del_dtimes timestamp,
CONSTRAINT pk_keypdef_id PRIMARY KEY (app_id)

);
29 changes: 29 additions & 0 deletions db_scripts/mosip_reg/ddl/reg-key_store.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- -------------------------------------------------------------------------------------------------
-- Database Name: mosip_reg
-- Table Name : reg.key_store
-- Purpose : Key Store: In MOSIP, data related to an individual in stored in encrypted form. This table is to manage all the keys(private and public keys) used.
--
-- Create By : Sadanandegowda DM
-- Created Date : Sep-2020
--
-- Modified Date Modified By Comments / Remarks
-- ------------------------------------------------------------------------------------------
-- Sep-2020 Sadanandegowda DM Update private_key data type and added certificate_data attribute
-- ------------------------------------------------------------------------------------------

-- object: reg.key_store | type: TABLE --
-- DROP TABLE IF EXISTS reg.key_store CASCADE;
CREATE TABLE reg.key_store(
id character varying(36) NOT NULL,
master_key character varying(36) NOT NULL,
private_key character varying(2500) NOT NULL,
certificate_data character varying(2500) NOT NULL,
cr_by character varying(256) NOT NULL,
cr_dtimes timestamp NOT NULL,
upd_by character varying(256),
upd_dtimes timestamp,
is_deleted boolean,
del_dtimes timestamp,
CONSTRAINT pk_keystr_id PRIMARY KEY (id)

);
4 changes: 4 additions & 0 deletions db_scripts/mosip_reg/mosip_reg_ddl_deploy.sql
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ run 'ddl/reg-identity_schema.sql';
run 'ddl/reg-dynamic_field.sql';
run 'ddl/reg-schema_definition.sql';

run 'ddl/reg-key_policy_def.sql';
run 'ddl/reg-key_alias.sql';
run 'ddl/reg-key_store.sql';

run 'ddl/reg-fk.sql';

run 'mosip_reg_dml_deploy.sql';
4 changes: 3 additions & 1 deletion db_scripts/mosip_reg/mosip_reg_dml_deploy.sql
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,6 @@ insert into reg.global_param values ('mosip.kernel.otp.expiry-time','mosip.kerne

insert into reg.global_param values ('auth.jwt.secret','auth.jwt.secret','authjwtsecret','CONFIGURATION','eng',true,'SYSTEM',current timestamp, 'SYSTEM',current timestamp, false, current timestamp);

insert into reg.global_param values ('auth.jwt.base','auth.jwt.base','Mosip-Token','CONFIGURATION','eng',true,'SYSTEM',current timestamp, 'SYSTEM',current timestamp, false, current timestamp);
insert into reg.global_param values ('auth.jwt.base','auth.jwt.base','Mosip-Token','CONFIGURATION','eng',true,'SYSTEM',current timestamp, 'SYSTEM',current timestamp, false, current timestamp);

insert into reg.key_policy_def (app_id, key_validity_duration, is_active, cr_by, cr_dtimes) VALUES('REGISTRATION', 1095, true, 'mosipadmin', current timestamp);
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import io.mosip.registration.processor.core.status.util.TrimExceptionMessage;
import io.mosip.registration.processor.core.util.JsonUtil;
import io.mosip.registration.processor.packet.storage.dto.ApplicantInfoDto;
import io.mosip.registration.processor.packet.storage.utils.BIRConverter;
import io.mosip.registration.processor.packet.storage.utils.PacketManagerService;
import io.mosip.registration.processor.packet.storage.utils.Utilities;
import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder;
Expand Down Expand Up @@ -509,7 +510,7 @@ private String getDataShareUrl(String id, String process) throws Exception {
JsonUtil.getJSONObject(regProcessorIdentityJson, MappingJsonConstants.INDIVIDUAL_BIOMETRICS),
MappingJsonConstants.VALUE);
BiometricRecord biometricRecord = packetManagerService.getBiometrics(id, individualBiometricsLabel, null, source, process);
byte[] content = cbeffutil.createXML(biometricRecord.getSegments());
byte[] content = cbeffutil.createXML(BIRConverter.convertSegmentsToBIRList(biometricRecord.getSegments()));

MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
map.add("name", individualBiometricsLabel);
Expand Down
Loading