SSO / Angular 2

I am trying to call an SSO endpoint with IONIC 2/ Angular 2 … I am trying to open an external website in the InAppBrowser but before calling the URL i need to pass an authentication token to the url as a parameter.

The Java cipher for encrypting the authentication token plain text is below

Cipher cipher = Cipher.getInstance(“AES/ECB/NoPadding”);
SecretKeySpec key = new SecretKeySpec(hexbytes,“AES”);
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] byteDataToEncrypt = plainText.getBytes(“UTF-8”);
byte[] byteCipherText = cipher.doFinal(byteDataToEncrypt);
hexencrypt = getHexString(byteCipherText);

How can i do this encryption in Angular?

Hope this is clear. If not do let me know

I would recommend trying to use WebCrypto as much as possible here.

Is there an example using it with angular?

There isn’t really anything angular-specific about it, because it doesn’t deal with UI or change detection. Here are some (hopefully) useful examples.