fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fineract] fynmanoj commented on a change in pull request #1032: FINERACT-1034-encryption-infra
Date Fri, 12 Jun 2020 00:17:29 GMT

fynmanoj commented on a change in pull request #1032:
URL: https://github.com/apache/fineract/pull/1032#discussion_r439140786



##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/crypt/service/CryptographyReadPlatformService.java
##########
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.infrastructure.crypt.service;
+
+import org.apache.fineract.infrastructure.crypt.data.CryptData;
+
+/**
+ * @author manoj
+ */
+public interface CryptographyReadPlatformService {
+    CryptData getPublicRsaKey(String type);

Review comment:
       yes, hence the class name is Cryptography* and I am implementing only RSA now.

##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/crypt/service/CryptographyReadPlatformServiceImpl.java
##########
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.infrastructure.crypt.service;
+
+import java.util.Base64;
+import org.apache.fineract.infrastructure.crypt.data.CryptData;
+import org.apache.fineract.infrastructure.crypt.domain.EncryptionKeys;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author manoj
+ */
+
+@Service
+public class CryptographyReadPlatformServiceImpl  implements CryptographyReadPlatformService{
+    private final EncryptionKeyStoreService encryptionKeyStore;
+
+
+    @Autowired
+    public CryptographyReadPlatformServiceImpl(EncryptionKeyStoreService encryptionKeyStore)
{
+        this.encryptionKeyStore = encryptionKeyStore;
+
+    }
+
+
+    @Override
+    public CryptData getPublicRsaKey(String type){
+        EncryptionKeys keys = this.encryptionKeyStore.retrieveKey(type);
+        return CryptData.instance(Base64.getEncoder().encodeToString(keys.getPublicKey()),
keys.getVersion());

Review comment:
       It was a single usage of the method so far.
   Changed it as you suggested for better reading and maintainability. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message