Tabnine Logo
InvalidKeyException.getMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
getMessage
method
in
java.security.InvalidKeyException

Best Java code snippets using java.security.InvalidKeyException.getMessage (Showing top 20 results out of 747)

origin: oracle/helidon

private Optional<String> validateRsaSha256(SecurityEnvironment env,
                      InboundClientDefinition clientDefinition) {
  try {
    Signature signature = Signature.getInstance("SHA256withRSA");
    signature.initVerify(clientDefinition.keyConfig()
                   .orElseThrow(() -> new HttpSignatureException("RSA public key configuration is "
                                              + "required"))
                   .publicKey()
                   .orElseThrow(() -> new HttpSignatureException(
                       "Public key is required, yet not configured")));
    signature.update(getBytesToSign(env, null));
    if (!signature.verify(this.signatureBytes)) {
      return Optional.of("Signature is not valid");
    }
    return Optional.empty();
  } catch (NoSuchAlgorithmException e) {
    LOGGER.log(Level.FINEST, "SHA256withRSA algorithm not found", e);
    return Optional.of("SHA256withRSA algorithm not found: " + e.getMessage());
  } catch (InvalidKeyException e) {
    LOGGER.log(Level.FINEST, "Invalid RSA key", e);
    return Optional.of("Invalid RSA key: " + e.getMessage());
  } catch (SignatureException e) {
    LOGGER.log(Level.FINEST, "Signature exception", e);
    return Optional.of("SignatureException: " + e.getMessage());
  }
}
origin: jwtk/jjwt

protected Mac getMacInstance() throws SignatureException {
  try {
    return doGetMacInstance();
  } catch (NoSuchAlgorithmException e) {
    String msg = "Unable to obtain JCA MAC algorithm '" + alg.getJcaName() + "': " + e.getMessage();
    throw new SignatureException(msg, e);
  } catch (InvalidKeyException e) {
    String msg = "The specified signing key is not a valid " + alg.name() + " key: " + e.getMessage();
    throw new SignatureException(msg, e);
  }
}
origin: jwtk/jjwt

@Override
public byte[] sign(byte[] data) {
  try {
    return doSign(data);
  } catch (InvalidKeyException e) {
    throw new SignatureException("Invalid RSA PrivateKey. " + e.getMessage(), e);
  } catch (java.security.SignatureException e) {
    throw new SignatureException("Unable to calculate signature using RSA PrivateKey. " + e.getMessage(), e);
  }
}
origin: jwtk/jjwt

@Override
public byte[] sign(byte[] data) {
  try {
    return doSign(data);
  } catch (InvalidKeyException e) {
    throw new SignatureException("Invalid Elliptic Curve PrivateKey. " + e.getMessage(), e);
  } catch (java.security.SignatureException e) {
    throw new SignatureException("Unable to calculate signature using Elliptic Curve PrivateKey. " + e.getMessage(), e);
  } catch (JwtException e) {
    throw new SignatureException("Unable to convert signature to JOSE format. " + e.getMessage(), e);
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit

  throw new IOException(MessageFormat.format(JGitText.get().noHMACsupport, HMAC, e.getMessage()));
} catch (InvalidKeyException e) {
  throw new IOException(MessageFormat.format(JGitText.get().invalidKey, e.getMessage()));
origin: hyperledger/fabric-sdk-java

    + e.getMessage() + "\r\nCertificate: "
    + DatatypeConverter.printHexBinary(pemCertificate), e);
logger.error(ex.getMessage(), ex);
origin: i2p/i2p.i2p

/** encrypt exactly 16 bytes using the session key
 * @param payload plaintext data, 16 bytes starting at inIndex
 * @param sessionKey private session key
 * @param out out parameter, 16 bytes starting at outIndex
 */
@Override
public final void encryptBlock(byte payload[], int inIndex, SessionKey sessionKey, byte out[], int outIndex) {
  Object pkey = sessionKey.getPreparedKey();
  if (pkey == null) {
    try {
      pkey = CryptixRijndael_Algorithm.makeKey(sessionKey.getData(), 16);
      sessionKey.setPreparedKey(pkey);
    } catch (InvalidKeyException ike) {
      _log.log(Log.CRIT, "Invalid key", ike);
      throw new IllegalArgumentException("invalid key?  " + ike.getMessage());
    }
  }
  
  CryptixRijndael_Algorithm.blockEncrypt(payload, out, inIndex, outIndex, pkey);
}
origin: i2p/i2p.i2p

/** decrypt exactly 16 bytes of data with the session key provided
 * @param payload encrypted data, 16 bytes starting at inIndex
 * @param sessionKey private session key
 * @param rv out parameter, 16 bytes starting at outIndex
 */
@Override
public final void decryptBlock(byte payload[], int inIndex, SessionKey sessionKey, byte rv[], int outIndex) {
  // just let it throw NPE or IAE later for speed, you'll figure it out
  //if ( (payload == null) || (rv == null) )
  //    throw new IllegalArgumentException("null block args");
  //if (payload.length - inIndex > rv.length - outIndex)
  //    throw new IllegalArgumentException("bad block args [payload.len=" + payload.length 
  //                                       + " inIndex=" + inIndex + " rv.len=" + rv.length 
  //                                       + " outIndex="+outIndex);
  Object pkey = sessionKey.getPreparedKey();
  if (pkey == null) {
    try {
      pkey = CryptixRijndael_Algorithm.makeKey(sessionKey.getData(), 16);
      sessionKey.setPreparedKey(pkey);
    } catch (InvalidKeyException ike) {
      _log.log(Log.CRIT, "Invalid key", ike);
      throw new IllegalArgumentException("invalid key?  " + ike.getMessage());
    }
  }
  CryptixRijndael_Algorithm.blockDecrypt(payload, rv, inIndex, outIndex, pkey);
}

origin: org.jasypt/jasypt

private void handleInvalidKeyException(final InvalidKeyException e) {
  if ((e.getMessage() != null) && 
      ((e.getMessage().toUpperCase().indexOf("KEY SIZE") != -1))) {
    
    throw new EncryptionOperationNotPossibleException(
        "Encryption raised an exception. A possible cause is " +
        "you are using strong encryption algorithms and " +
        "you have not installed the Java Cryptography " + 
        "Extension (JCE) Unlimited Strength Jurisdiction " +
        "Policy Files in this Java Virtual Machine");
    
  }
  
}

origin: org.apache.activemq/activemq-all

private void handleInvalidKeyException(final InvalidKeyException e) {
  if ((e.getMessage() != null) && 
      ((e.getMessage().toUpperCase().indexOf("KEY SIZE") != -1))) {
    
    throw new EncryptionOperationNotPossibleException(
        "Encryption raised an exception. A possible cause is " +
        "you are using strong encryption algorithms and " +
        "you have not installed the Java Cryptography " + 
        "Extension (JCE) Unlimited Strength Jurisdiction " +
        "Policy Files in this Java Virtual Machine");
    
  }
  
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt

private void handleInvalidKeyException(final InvalidKeyException e) {
  if ((e.getMessage() != null) && 
      ((e.getMessage().toUpperCase().indexOf("KEY SIZE") != -1))) {
    
    throw new EncryptionOperationNotPossibleException(
        "Encryption raised an exception. A possible cause is " +
        "you are using strong encryption algorithms and " +
        "you have not installed the Java Cryptography " + 
        "Extension (JCE) Unlimited Strength Jurisdiction " +
        "Policy Files in this Java Virtual Machine");
    
  }
  
}

origin: com.orientechnologies/orientdb-core

private Cipher getAndInitializeCipher(final int mode, final byte[] nonce) {
 try {
  Cipher cipher = CIPHER.get();
  cipher.init(mode, key, gcmParameterSpec(nonce));
  return cipher;
 } catch (InvalidKeyException e) {
  throw OException.wrapException(new OInvalidStorageEncryptionKeyException(e.getMessage()), e);
 } catch (InvalidAlgorithmParameterException e) {
  throw new IllegalArgumentException("Invalid or re-used nonce.", e);
 }
}
origin: org.bouncycastle/bcprov-debug-jdk15on

public String toString()
{
  try
  {
    return GOSTUtil.privateKeyToString("GOST3410", x,
      ((GOST3410PrivateKeyParameters)GOST3410Util.generatePrivateKeyParameter(this)).getParameters());
  }
  catch (InvalidKeyException e)
  {
    throw new IllegalStateException(e.getMessage()); // should not be possible
  }
}
origin: org.bouncycastle/bcprov-debug-jdk15on

public String toString()
{
  try
  {
    return GOSTUtil.publicKeyToString("GOST3410", y,
      ((GOST3410PublicKeyParameters)GOST3410Util.generatePublicKeyParameter(this)).getParameters());
  }
  catch (InvalidKeyException e)
  {
    throw new IllegalStateException(e.getMessage()); // should not be possible
  }
}

origin: io.jsonwebtoken/jjwt-impl

protected Mac getMacInstance() throws SignatureException {
  try {
    return doGetMacInstance();
  } catch (NoSuchAlgorithmException e) {
    String msg = "Unable to obtain JCA MAC algorithm '" + alg.getJcaName() + "': " + e.getMessage();
    throw new SignatureException(msg, e);
  } catch (InvalidKeyException e) {
    String msg = "The specified signing key is not a valid " + alg.name() + " key: " + e.getMessage();
    throw new SignatureException(msg, e);
  }
}
origin: io.jsonwebtoken/jjwt

protected Mac getMacInstance() throws SignatureException {
  try {
    return doGetMacInstance();
  } catch (NoSuchAlgorithmException e) {
    String msg = "Unable to obtain JCA MAC algorithm '" + alg.getJcaName() + "': " + e.getMessage();
    throw new SignatureException(msg, e);
  } catch (InvalidKeyException e) {
    String msg = "The specified signing key is not a valid " + alg.name() + " key: " + e.getMessage();
    throw new SignatureException(msg, e);
  }
}
origin: io.jsonwebtoken/jjwt

@Override
public byte[] sign(byte[] data) {
  try {
    return doSign(data);
  } catch (InvalidKeyException e) {
    throw new SignatureException("Invalid RSA PrivateKey. " + e.getMessage(), e);
  } catch (java.security.SignatureException e) {
    throw new SignatureException("Unable to calculate signature using RSA PrivateKey. " + e.getMessage(), e);
  }
}
origin: io.jsonwebtoken/jjwt-impl

@Override
public byte[] sign(byte[] data) {
  try {
    return doSign(data);
  } catch (InvalidKeyException e) {
    throw new SignatureException("Invalid RSA PrivateKey. " + e.getMessage(), e);
  } catch (java.security.SignatureException e) {
    throw new SignatureException("Unable to calculate signature using RSA PrivateKey. " + e.getMessage(), e);
  }
}
origin: io.jsonwebtoken/jjwt

@Override
public byte[] sign(byte[] data) {
  try {
    return doSign(data);
  } catch (InvalidKeyException e) {
    throw new SignatureException("Invalid Elliptic Curve PrivateKey. " + e.getMessage(), e);
  } catch (java.security.SignatureException e) {
    throw new SignatureException("Unable to calculate signature using Elliptic Curve PrivateKey. " + e.getMessage(), e);
  } catch (JwtException e) {
    throw new SignatureException("Unable to convert signature to JOSE format. " + e.getMessage(), e);
  }
}
origin: io.jsonwebtoken/jjwt-impl

@Override
public byte[] sign(byte[] data) {
  try {
    return doSign(data);
  } catch (InvalidKeyException e) {
    throw new SignatureException("Invalid Elliptic Curve PrivateKey. " + e.getMessage(), e);
  } catch (java.security.SignatureException e) {
    throw new SignatureException("Unable to calculate signature using Elliptic Curve PrivateKey. " + e.getMessage(), e);
  } catch (JwtException e) {
    throw new SignatureException("Unable to convert signature to JOSE format. " + e.getMessage(), e);
  }
}
java.securityInvalidKeyExceptiongetMessage

Popular methods of InvalidKeyException

  • <init>
    Constructs a new instance of InvalidKeyException with the cause.
  • printStackTrace
  • toString
  • getLocalizedMessage
  • initCause
  • getStackTrace
  • setStackTrace
  • getCause
  • addSuppressed
  • fillInStackTrace

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • 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