congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
NoSuchPaddingException
Code IndexAdd Tabnine to your IDE (free)

How to use
NoSuchPaddingException
in
javax.crypto

Best Java code snippets using javax.crypto.NoSuchPaddingException (Showing top 20 results out of 837)

Refine searchRefine arrow

  • NoSuchAlgorithmException
  • Cipher
  • IllegalBlockSizeException
  • BadPaddingException
  • InvalidKeyException
origin: aa112901/remusic

private static byte[] decrypt(byte[] content, String password) {
  try {
    byte[] keyStr = getKey(password);
    SecretKeySpec key = new SecretKeySpec(keyStr, "AES");
    Cipher cipher = Cipher.getInstance(algorithmStr);//algorithmStr
    cipher.init(Cipher.DECRYPT_MODE, key);//   ʼ
    byte[] result = cipher.doFinal(content);
    return result; //
  } catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
  } catch (NoSuchPaddingException e) {
    e.printStackTrace();
  } catch (InvalidKeyException e) {
    e.printStackTrace();
  } catch (IllegalBlockSizeException e) {
    e.printStackTrace();
  } catch (BadPaddingException e) {
    e.printStackTrace();
  }
  return null;
}
origin: robovm/robovm

  Cipher cipher = Cipher.getInstance(algName);
  if (algParameters == null) {
    cipher.init(Cipher.DECRYPT_MODE, decryptKey);
  } else {
    cipher.init(Cipher.DECRYPT_MODE, decryptKey, algParameters);
  byte[] decryptedData = cipher.doFinal(encryptedData);
  throw new NoSuchAlgorithmException(e.getMessage());
} catch (InvalidAlgorithmParameterException e) {
  throw new NoSuchAlgorithmException(e.getMessage());
} catch (IllegalStateException e) {
  throw new InvalidKeyException(e.getMessage());
} catch (IllegalBlockSizeException e) {
  throw new InvalidKeyException(e.getMessage());
} catch (BadPaddingException e) {
  throw new InvalidKeyException(e.getMessage());
origin: org.apache.hadoop/hadoop-common

 static int get(String padding) throws NoSuchPaddingException {
  try {
   return Padding.valueOf(padding).ordinal();
  } catch (Exception e) {
   throw new NoSuchPaddingException("Doesn't support padding: " + padding);
  }
 }
}
origin: robovm/robovm

        NoSuchAlgorithmException, InvalidKeyException {
if (key == null) {
  throw new InvalidKeyException("key == null");
  Cipher cipher = Cipher.getInstance(sealAlg);
  if ((paramsAlg != null) && (paramsAlg.length() != 0)) {
    AlgorithmParameters params =
      AlgorithmParameters.getInstance(paramsAlg);
    params.init(encodedParams);
    cipher.init(Cipher.DECRYPT_MODE, key, params);
  } else {
    cipher.init(Cipher.DECRYPT_MODE, key);
  byte[] serialized = cipher.doFinal(encryptedContent);
  throw new NoSuchAlgorithmException(e.toString());
} catch (InvalidAlgorithmParameterException e) {
  throw new NoSuchAlgorithmException(e.toString());
} catch (IllegalBlockSizeException e) {
  throw new NoSuchAlgorithmException(e.toString());
} catch (BadPaddingException e) {
  throw new NoSuchAlgorithmException(e.toString());
} catch (IllegalStateException  e) {
origin: wang926454/ShiroJwt

  Cipher c = Cipher.getInstance("AES");
  c.init(Cipher.ENCRYPT_MODE, deskey);
  byte[] src = str.getBytes();
  byte[] cipherByte = c.doFinal(src);
  LOGGER.error("getInstance()方法异常:" + e.getMessage());
  throw new CustomUnauthorizedException("getInstance()方法异常:" + e.getMessage());
} catch (UnsupportedEncodingException e) {
  LOGGER.error("Bsae64加密异常:" + e.getMessage());
  throw new CustomUnauthorizedException("Bsae64加密异常:" + e.getMessage());
} catch (NoSuchPaddingException e) {
  LOGGER.error("getInstance()方法异常:" + e.getMessage());
  throw new CustomUnauthorizedException("getInstance()方法异常:" + e.getMessage());
} catch (InvalidKeyException e) {
  LOGGER.error("初始化Cipher对象异常:" + e.getMessage());
  throw new CustomUnauthorizedException("初始化Cipher对象异常:" + e.getMessage());
} catch (IllegalBlockSizeException e) {
  LOGGER.error("加密异常,密钥有误:" + e.getMessage());
  throw new CustomUnauthorizedException("加密异常,密钥有误:" + e.getMessage());
} catch (BadPaddingException e) {
  LOGGER.error("加密异常,密钥有误:" + e.getMessage());
  throw new CustomUnauthorizedException("加密异常,密钥有误:" + e.getMessage());
origin: org.teiid/teiid-common-core

/**
 * Initialize the ciphers used for encryption and decryption.  The ciphers
 * define the algorithms to be used.  They are initialized with the
 * appropriate key to be used in the encryption or decryption operation.
 */
protected void initDecryptCipher() throws CryptoException {
  
  // Create and initialize decryption cipher
  try {
    decryptCipher = Cipher.getInstance( cipherAlgorithm); 
    decryptCipher.init( Cipher.DECRYPT_MODE, decryptKey, iv );
  } catch ( NoSuchAlgorithmException e ) {
     throw new CryptoException(CorePlugin.Event.TEIID10009,  e,  CorePlugin.Util.gs(CorePlugin.Event.TEIID10009, cipherAlgorithm ));
  } catch ( NoSuchPaddingException e ) {
     throw new CryptoException(CorePlugin.Event.TEIID10010,  CorePlugin.Util.gs(CorePlugin.Event.TEIID10010, cipherAlgorithm, e.getClass().getName(),  e.getMessage() ));
  } catch ( InvalidKeyException e ) {
     throw new CryptoException(CorePlugin.Event.TEIID10011,  e, CorePlugin.Util.gs(CorePlugin.Event.TEIID10011, e.getClass().getName(), e.getMessage()) );
  } catch (InvalidAlgorithmParameterException e) {
    throw new CryptoException(CorePlugin.Event.TEIID10009,  e,  CorePlugin.Util.gs(CorePlugin.Event.TEIID10009, cipherAlgorithm ));
  }
}

origin: org.tmatesoft.svnkit/svnkit

private Cipher getCipher(byte[] key) throws SVNException {
  try {
    final Cipher ecipher = Cipher.getInstance("DES/ECB/NoPadding");
    key = setupKey(key);
    ecipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "DES"));
    return ecipher;
  } catch (NoSuchAlgorithmException e) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "DES encryption is not available: {0}", e.getLocalizedMessage());
    SVNErrorManager.error(err, SVNLogType.NETWORK);
  } catch (InvalidKeyException e) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Invalid key for DES encryption: {0}", e.getLocalizedMessage());
    SVNErrorManager.error(err, SVNLogType.NETWORK);
  } catch (NoSuchPaddingException e) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "NoPadding option for DES is not available: {0}", e.getLocalizedMessage());
    SVNErrorManager.error(err, SVNLogType.NETWORK);
  }
  return null;
}

origin: com.madgag.spongycastle/prov

if (provider == null)
  c = Cipher.getInstance("AES/CCM/NoPadding");
  c = Cipher.getInstance("AES/CCM/NoPadding", provider);
c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(keyBytes, "AES"));
byte[] encOut = c.doFinal(storeData.getEncoded());
throw new NoSuchAlgorithmException(e.toString());
throw new IOException(e.toString());
throw new IOException(e.toString());
throw new IOException(e.toString());
origin: org.postgresql/postgresql

   Cipher cipher;
   try {
    cipher = Cipher.getInstance(ePKInfo.getAlgName());
   } catch (NoSuchPaddingException npex) {
    throw new NoSuchAlgorithmException(npex.getMessage(), npex);
    cipher.init(Cipher.DECRYPT_MODE, pbeKey, algParams);
} catch (NoSuchAlgorithmException ex) {
 error = new PSQLException(GT.tr("Could not find a java cryptographic algorithm: {0}.",
     ex.getMessage()), PSQLState.CONNECTION_FAILURE, ex);
 return null;
origin: aa112901/remusic

  e.printStackTrace();
try {
  cipher = Cipher.getInstance(algorithmStr);
} catch (NoSuchAlgorithmException e) {
  e.printStackTrace();
} catch (NoSuchPaddingException e) {
  e.printStackTrace();
origin: com.braintreepayments/encryption

  private static Cipher aesCipher() throws BraintreeEncryptionException {
    try {
      return Cipher.getInstance(TRANSFORMATION);
    } catch (NoSuchAlgorithmException e) {
      throw new BraintreeEncryptionException("No Such Algorithm: " + e.getMessage());
    } catch (NoSuchPaddingException e) {
      throw new BraintreeEncryptionException("No Such Padding: " + e.getMessage());
    }
  }
}
origin: com.github.mwegrz/scala-util

private AesCmac(Key key, int length) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException {
  if (length > BLOCK_SIZE) {
    throw new NoSuchAlgorithmException("AES CMAC maximum length is " + BLOCK_SIZE);
  }
  try {
    macLength = length;
    aesCipher = Cipher.getInstance("AES_128/CBC/NoPadding");
    buffer = new byte[BLOCK_SIZE];
  } catch (NoSuchPaddingException nspe) {
    nspe.printStackTrace();
  }
  init(key);
}
origin: org.bouncycastle/bcprov-debug-jdk15on

  byte[] encOut = c.doFinal(storeData.getEncoded());
  AlgorithmParameters algorithmParameters = c.getParameters();
  byte[] encOut = c.doFinal(storeData.getEncoded());
  PBES2Parameters pbeParams = new PBES2Parameters(pbkdAlgId, new EncryptionScheme(NISTObjectIdentifiers.id_aes256_wrap_pad));
throw new NoSuchAlgorithmException(e.toString());
throw new IOException(e.toString());
throw new IOException(e.toString());
throw new IOException(e.toString());
origin: be.fedict.commons-eid/commons-eid-consumer

  return __verifyNonRepSignature(expectedDigestValue, signatureValue, certificate);
} catch (final InvalidKeyException ikex) {
  LOGGER.warn("invalid key: " + ikex.getMessage(), ikex);
  return false;
} catch (final NoSuchAlgorithmException nsaex) {
  LOGGER.warn("no such algo: " + nsaex.getMessage(), nsaex);
  return false;
} catch (final NoSuchPaddingException nspex) {
  LOGGER.warn("no such padding: " + nspex.getMessage(), nspex);
  return false;
} catch (final BadPaddingException bpex) {
  LOGGER.warn("bad padding: " + bpex.getMessage(), bpex);
  return false;
} catch (final IOException ioex) {
  return false;
} catch (final IllegalBlockSizeException ibex) {
  LOGGER.warn("illegal block size: " + ibex.getMessage(), ibex);
  return false;
origin: schwabe/ics-openvpn

@Override
public byte[] getSignedData(String alias, byte[] data) throws RemoteException {
  try {
    return SimpleSigner.signData(data);
  } catch (IOException e) {
    e.printStackTrace();
  } catch (NoSuchPaddingException e) {
    e.printStackTrace();
  } catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
  } catch (IllegalBlockSizeException e) {
    e.printStackTrace();
  } catch (BadPaddingException e) {
    e.printStackTrace();
  } catch (InvalidKeySpecException e) {
    e.printStackTrace();
  } catch (InvalidKeyException e) {
    e.printStackTrace();
  }
  // Something failed, return null
  return null;
}
origin: org.streampipes/streampipes-empire-cp-common-utils

/**
 * Returns an inputstream that will decrypt the bytes coming in through the specified input using the given key
 * @param theStream the stream to read encrypted data from
 * @param theKey the key to use for decryption
 * @return an input stream that will decrypt the data
 * @throws IOException if the stream cannot be read from, or if there is an error while decrypting
 */
public static InputStream decrypt(InputStream theStream, SecretKey theKey) throws IOException {
  try {
    return new CipherInputStream(theStream, createDecryptCipher(theKey));
  }
  catch (InvalidAlgorithmParameterException e) {
    throw new IOException(e.getMessage());
  }
  catch (InvalidKeyException e) {
    throw new IOException(e.getMessage());
  }
  catch (NoSuchAlgorithmException e) {
    throw new IOException(e.getMessage());
  }
  catch (NoSuchPaddingException e) {
    throw new IOException(e.getMessage());
  }
}
origin: com.pubnub/pubnub

public String encrypt(String input) throws PubNubException {
  try {
    initCiphers();
    AlgorithmParameterSpec ivSpec = new IvParameterSpec(ivBytes);
    SecretKeySpec newKey = new SecretKeySpec(keyBytes, "AES");
    Cipher cipher = null;
    cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
    cipher.init(Cipher.ENCRYPT_MODE, newKey, ivSpec);
    return new String(Base64.encode(cipher.doFinal(input.getBytes("UTF-8")), 0), Charset.forName("UTF-8"));
  } catch (NoSuchAlgorithmException e) {
    throw PubNubException.builder().errormsg(e.toString()).build();
  } catch (NoSuchPaddingException e) {
    throw PubNubException.builder().errormsg(e.toString()).build();
  } catch (InvalidKeyException e) {
    throw PubNubException.builder().errormsg(e.toString()).build();
  } catch (InvalidAlgorithmParameterException e) {
    throw PubNubException.builder().errormsg(e.toString()).build();
  } catch (UnsupportedEncodingException e) {
    throw PubNubException.builder().errormsg(e.toString()).build();
  } catch (IllegalBlockSizeException e) {
    throw PubNubException.builder().errormsg(e.toString()).build();
  } catch (BadPaddingException e) {
    throw PubNubException.builder().errormsg(e.toString()).build();
  }
}
origin: ibinti/bugvm

public CipherSpi(
  OAEPParameterSpec pSpec)
{
  try
  {
    initFromSpec(pSpec);
  }
  catch (NoSuchPaddingException e)
  {
    throw new IllegalArgumentException(e.getMessage());
  }
}
origin: cloudant/sync-android

  throw new DPKException("Failed to encrypt DPK.  Cause: " + e.getLocalizedMessage(), e);
} catch (NoSuchPaddingException e) {
  throw new DPKException("Failed to encrypt DPK.  Cause: " + e.getLocalizedMessage(), e);
} catch (NoSuchAlgorithmException e) {
  throw new DPKException("Failed to encrypt DPK.  Cause: " + e.getLocalizedMessage(), e);
} catch (IllegalBlockSizeException e) {
  throw new DPKException("Failed to encrypt DPK.  Cause: " + e.getLocalizedMessage(), e);
} catch (BadPaddingException e) {
  throw new DPKException("Failed to encrypt DPK.  Cause: " + e.getLocalizedMessage(), e);
} catch (InvalidAlgorithmParameterException e) {
  throw new DPKException("Failed to encrypt DPK.  Cause: " + e.getLocalizedMessage(), e);
origin: robovm/robovm

  Cipher cipher = Cipher.getInstance(sealAlg, provider);
  if ((paramsAlg != null) && (paramsAlg.length() != 0)) {
    AlgorithmParameters params =
      AlgorithmParameters.getInstance(paramsAlg);
    params.init(encodedParams);
    cipher.init(Cipher.DECRYPT_MODE, key, params);
  } else {
    cipher.init(Cipher.DECRYPT_MODE, key);
  byte[] serialized = cipher.doFinal(encryptedContent);
  throw new NoSuchAlgorithmException(e.toString());
} catch (InvalidAlgorithmParameterException e) {
  throw new NoSuchAlgorithmException(e.toString());
} catch (IllegalBlockSizeException e) {
  throw new NoSuchAlgorithmException(e.toString());
} catch (BadPaddingException e) {
  throw new NoSuchAlgorithmException(e.toString());
} catch (IllegalStateException  e) {
javax.cryptoNoSuchPaddingException

Javadoc

The exception that is thrown when the requested padding mechanism is not supported.

Most used methods

  • printStackTrace
  • getMessage
  • <init>
    Creates a new NoSuchPaddingException with the specified message.
  • toString
  • getLocalizedMessage
  • initCause

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now