public static boolean unregisterPrivateKeyObfuscator(PrivateKeyObfuscator o) { Objects.requireNonNull(o, "No instance provided"); String cipherName = o.getCipherName(); ValidateUtils.checkNotNullAndNotEmpty(cipherName, "No cipher name"); synchronized (OBFUSCATORS) { PrivateKeyObfuscator prev = OBFUSCATORS.get(cipherName); if (prev != o) { return false; } OBFUSCATORS.remove(cipherName); } return true; }
protected byte[] applyPrivateKeyCipher(byte[] bytes, PrivateKeyEncryptionContext encContext, boolean encryptIt) throws GeneralSecurityException { String cipherName = encContext.getCipherName(); PrivateKeyObfuscator o = encContext.resolvePrivateKeyObfuscator(); if (o == null) { throw new NoSuchAlgorithmException("decryptPrivateKeyData(" + encContext + ")[encrypt=" + encryptIt + "] unknown cipher: " + cipherName); } if (encryptIt) { byte[] initVector = encContext.getInitVector(); if (GenericUtils.isEmpty(initVector)) { initVector = o.generateInitializationVector(encContext); encContext.setInitVector(initVector); } } return o.applyPrivateKeyCipher(bytes, encContext, encryptIt); } }
protected byte[] applyPrivateKeyCipher( byte[] bytes, PrivateKeyEncryptionContext encContext, boolean encryptIt) throws GeneralSecurityException, IOException { String cipherName = encContext.getCipherName(); PrivateKeyObfuscator o = encContext.resolvePrivateKeyObfuscator(); if (o == null) { throw new NoSuchAlgorithmException("decryptPrivateKeyData(" + encContext + ")[encrypt=" + encryptIt + "] unknown cipher: " + cipherName); } if (encryptIt) { byte[] initVector = encContext.getInitVector(); if (GenericUtils.isEmpty(initVector)) { initVector = o.generateInitializationVector(encContext); encContext.setInitVector(initVector); } } return o.applyPrivateKeyCipher(bytes, encContext, encryptIt); } }
public static boolean unregisterPrivateKeyObfuscator(PrivateKeyObfuscator o) { Objects.requireNonNull(o, "No instance provided"); String cipherName = o.getCipherName(); ValidateUtils.checkNotNullAndNotEmpty(cipherName, "No cipher name"); synchronized (OBFUSCATORS) { PrivateKeyObfuscator prev = OBFUSCATORS.get(cipherName); if (prev != o) { return false; } OBFUSCATORS.remove(cipherName); } return true; }
public static PrivateKeyObfuscator registerPrivateKeyObfuscator(PrivateKeyObfuscator o) { return registerPrivateKeyObfuscator(Objects.requireNonNull(o, "No instance provided").getCipherName(), o); }
public static PrivateKeyObfuscator registerPrivateKeyObfuscator(PrivateKeyObfuscator o) { return registerPrivateKeyObfuscator(Objects.requireNonNull(o, "No instance provided").getCipherName(), o); }
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; } }