Class SecurityDataService


  • @Service
    public class SecurityDataService
    extends Object
    • Constructor Detail

      • SecurityDataService

        @Autowired
        public SecurityDataService​(org.springframework.core.env.Environment environment,
                                   CryptoProviderHolder cryptoProviderHolder)
    • Method Detail

      • encryptId

        public Optional<String> encryptId​(String originalId)
        Encrypts external consent ID with secret consent key via configuration server key
        Parameters:
        originalId - external consent ID to encrypt
        Returns:
        String encrypted external consent ID
      • decryptId

        public Optional<String> decryptId​(String encryptedId)
        Decrypts encrypted external ID
        Parameters:
        encryptedId - encrypted ID for the input
        Returns:
        String original ID
      • encryptConsentData

        public Optional<EncryptedData> encryptConsentData​(String encryptedId,
                                                          byte[] aspspConsentData)
        Encrypts ASPSP consent data
        Parameters:
        encryptedId - encrypted consent ID
        aspspConsentData - original data to be encrypted
        Returns:
        response contains encrypted data
      • decryptConsentData

        public Optional<DecryptedData> decryptConsentData​(String encryptedId,
                                                          byte[] aspspConsentData)
        Decrypt ASPSP consent data
        Parameters:
        encryptedId - encrypted consent ID
        aspspConsentData - encrypted data to be decrypted
        Returns:
        response contains decrypted data
      • isConsentIdEncrypted

        public boolean isConsentIdEncrypted​(String consentId)
        Checks whether paymentId is encrypted or not
        Parameters:
        consentId - id of consent
        Returns:
        true if paymentId is encrypted. false otherwise.