public static Mac getMAC(final Algorithm alg) { try { return javax.crypto.Mac.getInstance(getJavaAlgorithm(alg)); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(Messages.MESSAGES.unsupportedHMACalgorithm(e.getLocalizedMessage()), e); } }
throw new RuntimeException(Messages.MESSAGES.unsupportedHMACalgorithm(e.getLocalizedMessage()), e);
public MD5Digester() throws P4JavaError { try { messageDigest = MessageDigest.getInstance(DIGEST_TYPE); messageDigest.reset(); } catch (NoSuchAlgorithmException exc) { throw new P4JavaError( "Unable to create an MD5 digester for P4Java: " + exc.getLocalizedMessage(), exc); } }
public MD5Digester() throws P4JavaError { try { messageDigest = MessageDigest.getInstance(DIGEST_TYPE); messageDigest.reset(); } catch (NoSuchAlgorithmException exc) { throw new P4JavaError( "Unable to create an MD5 digester for P4Java: " + exc.getLocalizedMessage(), exc); } }
/** * Registers a resource. * * @param resource * the resource to be registered. * @return the generated identifier under which the resource has been * registered. */ public String register(IResource resource) { try { String id = createId(); resources.put(id, resource); return id; } catch (NoSuchAlgorithmException nsae) { throw new IllegalStateException("Could not generate random id: " + nsae.getLocalizedMessage()); } }
public static Mac getMAC(final Algorithm alg) { try { return javax.crypto.Mac.getInstance(getJavaAlgorithm(alg)); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(Messages.MESSAGES.unsupportedHMACalgorithm(e.getLocalizedMessage()), e); } }
public Map<String, String> invoke(File f, VirtualChannel channel) throws IOException { try { return FileChecksumCalculator.calculateChecksums(f, "md5", "sha1"); } catch (NoSuchAlgorithmException e) { log.warn("Could not find checksum algorithm: " + e.getLocalizedMessage()); } return null; } }
private static void getRandomInfo(byte[] node) throws SVNException { UID uid = new UID(); MessageDigest digest = null; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } digest.update(uid.toString().getBytes()); byte[] seed = digest.digest(); int numToCopy = node.length < seed.length ? node.length : seed.length; System.arraycopy(seed, 0, node, 0, numToCopy); node[0] |= 0x01; } }
/** * Method IntegrityHmac * * @throws XMLSignatureException */ public IntegrityHmac() throws XMLSignatureException { String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI()); LOG.debug("Created IntegrityHmacSHA1 using {}", algorithmID); try { this.macAlgorithm = Mac.getInstance(algorithmID); } catch (java.security.NoSuchAlgorithmException ex) { Object[] exArgs = { algorithmID, ex.getLocalizedMessage() }; throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs); } }
private static void getRandomInfo(byte[] node) throws SVNException { UID uid = new UID(); MessageDigest digest = null; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } digest.update(uid.toString().getBytes()); byte[] seed = digest.digest(); int numToCopy = node.length < seed.length ? node.length : seed.length; System.arraycopy(seed, 0, node, 0, numToCopy); node[0] |= 0x01; } }
private static void getRandomInfo(byte[] node) throws SVNException { UID uid = new UID(); MessageDigest digest = null; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", e.getLocalizedMessage()); SVNErrorManager.error(err, e); } digest.update(uid.toString().getBytes()); byte[] seed = digest.digest(); int numToCopy = node.length < seed.length ? node.length : seed.length; System.arraycopy(seed, 0, node, 0, numToCopy); node[0] |= 0x01; } }
private static void getRandomInfo(byte[] node) throws SVNException { UID uid = new UID(); MessageDigest digest = null; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } digest.update(uid.toString().getBytes()); byte[] seed = digest.digest(); int numToCopy = node.length < seed.length ? node.length : seed.length; System.arraycopy(seed, 0, node, 0, numToCopy); node[0] |= 0x01; } }
public String getDigestFromRepositoryPath(String repositoryPath) throws SVNException { MessageDigest digestFromPath = null; try { digestFromPath = MessageDigest.getInstance("MD5"); digestFromPath.update(repositoryPath.getBytes("UTF-8")); } catch (NoSuchAlgorithmException nsae) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", nsae.getLocalizedMessage()); SVNErrorManager.error(err, nsae); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe); } return SVNFileUtil.toHexDigest(digestFromPath); }
public String getDigestFromRepositoryPath(String repositoryPath) throws SVNException { repositoryPath = SVNPathUtil.canonicalizeAbsolutePath(repositoryPath); MessageDigest digestFromPath = null; try { digestFromPath = MessageDigest.getInstance("MD5"); digestFromPath.update(repositoryPath.getBytes("UTF-8")); } catch (NoSuchAlgorithmException nsae) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", nsae.getLocalizedMessage()); SVNErrorManager.error(err, nsae, SVNLogType.FSFS); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } return SVNFileUtil.toHexDigest(digestFromPath); }
public String getDigestFromRepositoryPath(String repositoryPath) throws SVNException { repositoryPath = SVNPathUtil.canonicalizeAbsolutePath(repositoryPath); MessageDigest digestFromPath = null; try { digestFromPath = MessageDigest.getInstance("MD5"); digestFromPath.update(repositoryPath.getBytes("UTF-8")); } catch (NoSuchAlgorithmException nsae) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", nsae.getLocalizedMessage()); SVNErrorManager.error(err, nsae, SVNLogType.FSFS); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } return SVNFileUtil.toHexDigest(digestFromPath); }
public String getDigestFromRepositoryPath(String repositoryPath) throws SVNException { repositoryPath = SVNPathUtil.canonicalizeAbsolutePath(repositoryPath); MessageDigest digestFromPath = null; try { digestFromPath = MessageDigest.getInstance("MD5"); digestFromPath.update(repositoryPath.getBytes("UTF-8")); } catch (NoSuchAlgorithmException nsae) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", nsae.getLocalizedMessage()); SVNErrorManager.error(err, nsae, SVNLogType.FSFS); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } return SVNFileUtil.toHexDigest(digestFromPath); }
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; }
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; }
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); } catch (InvalidKeyException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Invalid key for DES encryption: {0}", e.getLocalizedMessage()); SVNErrorManager.error(err); } catch (NoSuchPaddingException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "NoPadding option for DES is not available: {0}", e.getLocalizedMessage()); SVNErrorManager.error(err); } return null; }
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; }