cancel
Showing results for 
Search instead for 
Did you mean: 

Access to Keystore from UDF to get Public Key import error

0 Kudos
673

Hello everyone.

I am trying to access keystore from UDF in my mapping and get public key from certificate. Version of SAP PI 7.5 SP15

My code is:

import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.PublicKey;
import com.sap.aii.security.lib;
import com.sap.engine.interfaces.keystore.KeystoreManager;<br>
public String getPublicKey(String view, String alias, Container container) throws StreamTransformationException{	                                                            KeyStore keystore = getKeystore(view);
	PublicKey publicKey = null;
	try {
	    publicKey = keystore.getCertificate(alias).getPublicKey();
	    if (publicKey == null) {
		return "public key is null";
	    }
	} catch (Exception e) {
                e.printStackTrace();
	}


	return publicKey;
}<br>

But while I am importing libraries - I am getting the following error:

  • error: package com.sap.aii.security.lib does not existimport com.sap.aii.security.lib;
    
  • error: package com.sap.engine.interfaces.keystore does not exist
    import com.sap.engine.interfaces.keystore.KeystoreManager;

Could you please help. What is incorrect here?

Accepted Solutions (0)

Answers (1)

Answers (1)

r_herrmann
Active Contributor
0 Kudos

Hi Olesya,

I think the import statements are not correct. From my memories they should look like these:

import com.sap.aii.security.lib.KeyStoreManager;
//... or more generic
import com.sap.aii.security.lib.*;
0 Kudos

Hello, Raffael!

Here i have the same issue:

error: package com.sap.aii.security.lib does not exist

import com.sap.aii.security.lib.*;

error: package com.sap.aii.security.lib does not exist

import com.sap.aii.security.lib.KeyStoreManager;