From Buff Monkey, 5 Years ago, written in Plain Text.
Embed
  1. Caller statement: OAuthService
  2. PrivateKey privateKey = encryptionUtilities.string2PrivateKey(strPrivateKey);
  3.             long startTime = System.currentTimeMillis();
  4.             String accessToken = jwtHelper.generateToken(payload, privateKey, tokenExpirationInMilliSeconds);
  5.             LOGGER.info("Time spend in getOauthToken jwtHelper.generateToken {}", System.currentTimeMillis() - startTime);
  6.  
  7.  
  8. EncryptionUtil.java
  9. public PrivateKey string2PrivateKey(String privateKeyString) {
  10.         long startTime = System.currentTimeMillis();
  11.         try {
  12.             KeyFactory kf = KeyFactory.getInstance(ServiceConstants.RSA);
  13.             PKCS8EncodedKeySpec keySpecPKCS8 = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKeyString));
  14.             PrivateKey privateKey = kf.generatePrivate(keySpecPKCS8);
  15.             LOGGER.info("Time spend in string2PrivateKey {}", System.currentTimeMillis() - startTime);
  16.             return privateKey;
  17.         } catch (IllegalArgumentException | InvalidKeySpecException | NoSuchAlgorithmException e) {
  18.             LOGGER.error(e.getMessage(), e);
  19.             return null;
  20.         }
  21.     }
  22.  
  23.  

Replies to Untitled rss

Title Name Language When
Re: Untitled Sexy Flamingo text 5 Years ago.