本文整理了Java中javax.crypto.BadPaddingException.getMessage()
方法的一些代码示例,展示了BadPaddingException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BadPaddingException.getMessage()
方法的具体详情如下:
包路径:javax.crypto.BadPaddingException
类名称:BadPaddingException
方法名:getMessage
暂无
代码示例来源:origin: robovm/robovm
throw new IOException(e.getMessage());
} catch (IllegalBlockSizeException e) {
throw new IOException(e.getMessage());
代码示例来源:origin: robovm/robovm
throw new InvalidKeyException(e.getMessage());
} catch (BadPaddingException e) {
throw new InvalidKeyException(e.getMessage());
代码示例来源:origin: robovm/robovm
throw new InvalidKeyException(e.getMessage());
} catch (BadPaddingException e) {
throw new InvalidKeyException(e.getMessage());
代码示例来源:origin: robovm/robovm
throw new InvalidKeyException(e.getMessage());
} catch (BadPaddingException e) {
throw new InvalidKeyException(e.getMessage());
代码示例来源:origin: robovm/robovm
throw new InvalidKeySpecException(e.getMessage());
} catch (BadPaddingException e) {
throw new InvalidKeySpecException(e.getMessage());
代码示例来源:origin: org.xipki/security
@Override
public byte[] getSignature() {
try {
return cipher.doFinal();
} catch (IllegalBlockSizeException ex) {
throw new IllegalStateException("IllegalBlockSizeException: " + ex.getMessage());
} catch (BadPaddingException ex) {
throw new IllegalStateException("BadPaddingException: " + ex.getMessage());
}
}
代码示例来源:origin: com.walmartlabs.concord.server/concord-server
public static InputStream decrypt(InputStream input, byte[] password, byte[] salt) {
try {
Cipher c = init(password, salt, Cipher.DECRYPT_MODE);
return new CipherInputStream(input, c);
} catch (BadPaddingException e) {
throw new SecurityException("Error decrypting a secret: " + e.getMessage() + ". Invalid input data and/or a password.");
} catch (GeneralSecurityException e) {
throw new SecurityException("Error decrypting a secret: " + e.getMessage());
}
}
代码示例来源:origin: org.xipki.tk/security
@Override
public byte[] getSignature() {
try {
return cipher.doFinal();
} catch (IllegalBlockSizeException ex) {
throw new IllegalStateException("IllegalBlockSizeException: " + ex.getMessage());
} catch (BadPaddingException ex) {
throw new IllegalStateException("BadPaddingException: " + ex.getMessage());
}
}
代码示例来源:origin: apache/fop
private static byte[] encryptWithKey(byte[] key, byte[] data) {
try {
final Cipher c = initCipher(key);
return c.doFinal(data);
} catch (IllegalBlockSizeException e) {
throw new IllegalStateException(e.getMessage());
} catch (BadPaddingException e) {
throw new IllegalStateException(e.getMessage());
}
}
代码示例来源:origin: apache/fop
private static byte[] encryptWithKey(byte[] key, byte[] data, boolean noPadding, byte[] iv) {
try {
final Cipher c = initCipher(key, noPadding, iv);
return c.doFinal(data);
} catch (IllegalBlockSizeException e) {
throw new IllegalStateException(e.getMessage());
} catch (BadPaddingException e) {
throw new IllegalStateException(e.getMessage());
}
}
代码示例来源:origin: com.madgag.spongycastle/prov
protected byte[] engineWrap(
Key key)
throws IllegalBlockSizeException, java.security.InvalidKeyException
{
byte[] encoded = key.getEncoded();
if (encoded == null)
{
throw new InvalidKeyException("Cannot wrap key, null encoding.");
}
try
{
return engineDoFinal(encoded, 0, encoded.length);
}
catch (BadPaddingException e)
{
throw new IllegalBlockSizeException(e.getMessage());
}
}
代码示例来源:origin: ibinti/bugvm
protected byte[] engineWrap(
Key key)
throws IllegalBlockSizeException, InvalidKeyException
{
byte[] encoded = key.getEncoded();
if (encoded == null)
{
throw new InvalidKeyException("Cannot wrap key, null encoding.");
}
try
{
return engineDoFinal(encoded, 0, encoded.length);
}
catch (BadPaddingException e)
{
throw new IllegalBlockSizeException(e.getMessage());
}
}
代码示例来源:origin: com.madgag/scprov-jdk15on
protected byte[] engineWrap(
Key key)
throws IllegalBlockSizeException, java.security.InvalidKeyException
{
byte[] encoded = key.getEncoded();
if (encoded == null)
{
throw new InvalidKeyException("Cannot wrap key, null encoding.");
}
try
{
return engineDoFinal(encoded, 0, encoded.length);
}
catch (BadPaddingException e)
{
throw new IllegalBlockSizeException(e.getMessage());
}
}
代码示例来源:origin: ripple-unmaintained/ripple-lib-java
protected byte[] engineWrap(
Key key)
throws IllegalBlockSizeException, java.security.InvalidKeyException
{
byte[] encoded = key.getEncoded();
if (encoded == null)
{
throw new InvalidKeyException("Cannot wrap key, null encoding.");
}
try
{
return engineDoFinal(encoded, 0, encoded.length);
}
catch (BadPaddingException e)
{
throw new IllegalBlockSizeException(e.getMessage());
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
protected byte[] engineWrap(
Key key)
throws IllegalBlockSizeException, InvalidKeyException
{
byte[] encoded = key.getEncoded();
if (encoded == null)
{
throw new InvalidKeyException("Cannot wrap key, null encoding.");
}
try
{
return engineDoFinal(encoded, 0, encoded.length);
}
catch (BadPaddingException e)
{
throw new IllegalBlockSizeException(e.getMessage());
}
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
protected byte[] engineWrap(
Key key)
throws IllegalBlockSizeException, java.security.InvalidKeyException
{
byte[] encoded = key.getEncoded();
if (encoded == null)
{
throw new InvalidKeyException("Cannot wrap key, null encoding.");
}
try
{
return engineDoFinal(encoded, 0, encoded.length);
}
catch (BadPaddingException e)
{
throw new IllegalBlockSizeException(e.getMessage());
}
}
代码示例来源:origin: com.braintreepayments/encryption
public static String encrypt(String data, byte[] aesKey, byte[] iv) throws BraintreeEncryptionException {
SecretKeySpec key = new SecretKeySpec(aesKey, ALGORITHM);
Cipher cipher = aesCipher();
try {
IvParameterSpec ivParamSpec = new IvParameterSpec(iv);
cipher.init(Cipher.ENCRYPT_MODE, key, ivParamSpec);
byte[] encryptedBytes = cipher.doFinal(data.getBytes());
byte[] buffer = Arrays.copyOf(iv, iv.length + encryptedBytes.length);
System.arraycopy(encryptedBytes, 0, buffer, iv.length, encryptedBytes.length);
return new String(Base64.encode(buffer));
} catch (InvalidKeyException e) {
throw new BraintreeEncryptionException("Invalid Key: " + e.getMessage());
} catch (BadPaddingException e) {
throw new BraintreeEncryptionException("Bad Padding: " + e.getMessage());
} catch (IllegalBlockSizeException e) {
throw new BraintreeEncryptionException("Illegal Block Size: " + e.getMessage());
} catch (InvalidAlgorithmParameterException e) {
throw new BraintreeEncryptionException("Invalid Algorithm: " + e.getMessage());
}
}
代码示例来源:origin: com.braintreepayments/encryption
public static String encrypt(byte[] data, String publicKeyString) throws BraintreeEncryptionException {
Cipher rsa;
try {
rsa = Cipher.getInstance(TRANSFORMATION);
PublicKey publicKey = publicKey(publicKeyString);
rsa.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] encodedData = Base64.encode(data);
byte[] encryptedData = rsa.doFinal(encodedData);
return new String(Base64.encode(encryptedData));
} catch (NoSuchAlgorithmException e) {
throw new BraintreeEncryptionException("No Such Algorithm: " + e.getMessage());
} catch (NoSuchPaddingException e) {
throw new BraintreeEncryptionException("No Such Padding: " + e.getMessage());
} catch (InvalidKeyException e) {
throw new BraintreeEncryptionException("Invalid Key: " + e.getMessage());
} catch (IllegalBlockSizeException e) {
throw new BraintreeEncryptionException("Illegal Block Size: " + e.getMessage());
} catch (BadPaddingException e) {
throw new BraintreeEncryptionException("Bad Padding: " + e.getMessage());
}
}
代码示例来源:origin: org.xipki/security
private byte[] rsaX509Sign(byte[] dataToSign) throws P11TokenException {
ConcurrentBagEntry<Cipher> cipher;
try {
cipher = rsaCiphers.borrow(5000, TimeUnit.MILLISECONDS);
} catch (InterruptedException ex) {
throw new P11TokenException("could not take any idle signer");
}
if (cipher == null) {
throw new P11TokenException("no idle RSA cipher available");
}
try {
return cipher.value().doFinal(dataToSign);
} catch (BadPaddingException ex) {
throw new P11TokenException("BadPaddingException: " + ex.getMessage(), ex);
} catch (IllegalBlockSizeException ex) {
throw new P11TokenException("IllegalBlockSizeException: " + ex.getMessage(), ex);
} finally {
rsaCiphers.requite(cipher);
}
}
代码示例来源:origin: org.xipki.tk/security
private byte[] rsaX509Sign(final byte[] dataToSign) throws P11TokenException {
ConcurrentBagEntry<Cipher> cipher;
try {
cipher = rsaCiphers.borrow(5000, TimeUnit.MILLISECONDS);
} catch (InterruptedException ex) {
throw new P11TokenException("could not take any idle signer");
}
if (cipher == null) {
throw new P11TokenException("no idle RSA cipher available");
}
try {
return cipher.value().doFinal(dataToSign);
} catch (BadPaddingException ex) {
throw new P11TokenException("BadPaddingException: " + ex.getMessage(), ex);
} catch (IllegalBlockSizeException ex) {
throw new P11TokenException("IllegalBlockSizeException: " + ex.getMessage(), ex);
} finally {
rsaCiphers.requite(cipher);
}
}
内容来源于网络,如有侵权,请联系作者删除!