public static final PrivateKeyEncryptionContext resolveEffectiveContext(PrivateKeyEncryptionContext encContext) { if (encContext == null) { return null; } String cipherName = encContext.getCipherName(); String cipherType = encContext.getCipherType(); PrivateKeyEncryptionContext effContext = encContext; if ("EDE3".equalsIgnoreCase(cipherType)) { cipherName += "ede"; effContext = encContext.clone(); effContext.setCipherName(cipherName); } return effContext; } }
public static final PrivateKeyEncryptionContext resolveEffectiveContext(PrivateKeyEncryptionContext encContext) { if (encContext == null) { return null; } String cipherName = encContext.getCipherName(); String cipherType = encContext.getCipherType(); PrivateKeyEncryptionContext effContext = encContext; if ("EDE3".equalsIgnoreCase(cipherType)) { cipherName += "ede"; effContext = encContext.clone(); effContext.setCipherName(cipherName); } return effContext; } }
public static final <C extends PrivateKeyEncryptionContext> C initializeObfuscator(C context, PrivateKeyObfuscator o, String password) { context.setCipherName(o.getCipherName()); context.setPrivateKeyObfuscator(o); context.setPassword(password); return context; } }
public static final <C extends PrivateKeyEncryptionContext> C initializeObfuscator(C context, PrivateKeyObfuscator o, String password) { context.setCipherName(o.getCipherName()); context.setPrivateKeyObfuscator(o); context.setPassword(password); return context; } }
/** * @param <C> Generic context type * @param context The {@link PrivateKeyEncryptionContext} to update * @param algInfo The algorithm info - format: {@code <I>name</I>-<I>type</I>-<I>mode</I>} * @return The updated context */ public static final <C extends PrivateKeyEncryptionContext> C parseAlgorithmInfo(C context, String algInfo) { ValidateUtils.checkNotNullAndNotEmpty(algInfo, "No encryption algorithm data"); String[] cipherData = GenericUtils.split(algInfo, '-'); ValidateUtils.checkTrue(cipherData.length == 3, "Bad encryption algorithm data: %s", algInfo); context.setCipherName(cipherData[0]); context.setCipherType(cipherData[1]); context.setCipherMode(cipherData[2]); return context; }
/** * @param <C> Generic context type * @param context The {@link PrivateKeyEncryptionContext} to update * @param algInfo The algorithm info - format: {@code <I>name</I>-<I>type</I>-<I>mode</I>} * @return The updated context */ public static final <C extends PrivateKeyEncryptionContext> C parseAlgorithmInfo(C context, String algInfo) { ValidateUtils.checkNotNullAndNotEmpty(algInfo, "No encryption algorithm data"); String[] cipherData = GenericUtils.split(algInfo, '-'); ValidateUtils.checkTrue(cipherData.length == 3, "Bad encryption algorithm data: %s", algInfo); context.setCipherName(cipherData[0]); context.setCipherType(cipherData[1]); context.setCipherMode(cipherData[2]); return context; }