javax.crypto.CipherSpi Java Examples

The following examples show how to use javax.crypto.CipherSpi. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AirTunesCryptography.java    From Android-Airplay-Server with MIT License 6 votes vote down vote up
/**
 * Creates a {@link javax.crypto.Cipher} instance from a {@link javax.crypto.CipherSpi}.
 *
 * @param cipherSpi the {@link javax.cyrpto.CipherSpi} instance
 * @param transformation the transformation cipherSpi was obtained for
 * @return a {@link javax.crypto.Cipher} instance
 * @throws Throwable in case of an error
 */
private static Cipher getCipher(final CipherSpi cipherSpi, final String transformation) throws Throwable {
	
	//06-19 15:22:00.727: W/erverSocketPipelineSink(31810): Caused by: java.lang.NoSuchMethodException: <init> [class javax.crypto.CipherSpi, class java.lang.String]

	
	/* This API isn't public - usually you're expected to simply use Cipher.getInstance().
	 * Due to the signed-jar restriction for JCE providers that is not an option, so we
	 * use one of the private constructors of Cipher.
	 */
	final Class<Cipher> cipherClass = Cipher.class;
	final Constructor<Cipher> cipherConstructor = cipherClass.getDeclaredConstructor(CipherSpi.class, String.class);
	cipherConstructor.setAccessible(true);
	try {
		return cipherConstructor.newInstance(cipherSpi, transformation);
	}
	catch (final InvocationTargetException e) {
		throw e.getCause();
	}
}
 
Example #2
Source File: AirTunesCryptography.java    From Android-Airplay-Server with MIT License 5 votes vote down vote up
/**
 * Sets the mode of a {@link javax.crypto.CipherSpi} instance.
 *
 * Like {@link #getCipher(String)}, we're accessing a private API
 * here, so me must work around the access restrictions
 *
 * @param cipherSpi the {@link javax.crypto.CipherSpi} instance
 * @param mode the mode to set
 * @throws Throwable if {@link javax.crypto.CipherSpi#engineSetPadding} throws
 */
private static void cipherSpiSetMode(final CipherSpi cipherSpi, final String mode) throws Throwable {
	final Method engineSetMode = getMethod(cipherSpi.getClass(), "engineSetMode", String.class);
	engineSetMode.setAccessible(true);
	try {
		engineSetMode.invoke(cipherSpi, mode);
	}
	catch (final InvocationTargetException e) {
		throw e.getCause();
	}
}
 
Example #3
Source File: AirTunesCryptography.java    From Android-Airplay-Server with MIT License 5 votes vote down vote up
/**
 * Sets the padding of a {@link javax.crypto.CipherSpi} instance.
 *
 * Like {@link #getCipher(String)}, we're accessing a private API
 * here, so me must work around the access restrictions
 *
 * @param cipherSpi the {@link javax.crypto.CipherSpi} instance
 * @param padding the padding to set
 * @throws Throwable if {@link javax.crypto.CipherSpi#engineSetPadding} throws
 */
private static void cipherSpiSetPadding(final CipherSpi cipherSpi, final String padding) throws Throwable {
	final Method engineSetPadding = getMethod(cipherSpi.getClass(), "engineSetPadding", String.class);
	engineSetPadding.setAccessible(true);
	try {
		engineSetPadding.invoke(cipherSpi, padding);
	}
	catch (final InvocationTargetException e) {
		throw e.getCause();
	}
}
 
Example #4
Source File: KeyProtector.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #5
Source File: KeyProtector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #6
Source File: KeyProtector.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #7
Source File: KeyProtector.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #8
Source File: KeyProtector.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #9
Source File: KeyProtector.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #10
Source File: KeyProtector.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #11
Source File: KeyProtector.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #12
Source File: KeyProtector.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #13
Source File: KeyProtector.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #14
Source File: KeyProtector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #15
Source File: KeyProtector.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #16
Source File: KeyProtector.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}
 
Example #17
Source File: KeyProtector.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a Cipher object.
 *
 * @param cipherSpi the delegate
 * @param provider the provider
 * @param transformation the transformation
 */
protected CipherForKeyProtector(CipherSpi cipherSpi,
                                Provider provider,
                                String transformation) {
    super(cipherSpi, provider, transformation);
}