Print to stderr
This commit is contained in:
parent
37fa225d95
commit
6ed05f9e39
2 changed files with 11 additions and 11 deletions
|
@ -19,21 +19,21 @@ public class StreamAesUtils {
|
||||||
if (!hashMap.containsKey("nonce")) {
|
if (!hashMap.containsKey("nonce")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
System.out.println("cipher=" + (hashMap.get("cipher")));
|
System.err.println("cipher=" + (hashMap.get("cipher")));
|
||||||
System.out.println("username=" + (hashMap.get("username")));
|
System.err.println("username=" + (hashMap.get("username")));
|
||||||
System.out.println("padding=" + (hashMap.get("padding")));
|
System.err.println("padding=" + (hashMap.get("padding")));
|
||||||
System.out.println("algorithm=" + (hashMap.get("algorithm")));
|
System.err.println("algorithm=" + (hashMap.get("algorithm")));
|
||||||
System.out.println("nonce=" + (hashMap.get("nonce")));
|
System.err.println("nonce=" + (hashMap.get("nonce")));
|
||||||
return fromUserNonceSuperSecretKey(hashMap.get("username"), hashMap.get("nonce"), superSecretKey);
|
return fromUserNonceSuperSecretKey(hashMap.get("username"), hashMap.get("nonce"), superSecretKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Aes fromUserNonceSuperSecretKey(String username, String nonce, String superSecretKey) throws NoSuchAlgorithmException {
|
public static Aes fromUserNonceSuperSecretKey(String username, String nonce, String superSecretKey) throws NoSuchAlgorithmException {
|
||||||
if (GenKey.generateDefaultUsername().equals(username)) {
|
if (GenKey.generateDefaultUsername().equals(username)) {
|
||||||
System.out.println("AES use User Password");
|
System.err.println("AES use User Password");
|
||||||
} else if ("none".equals(username)) {
|
} else if ("none".equals(username)) {
|
||||||
superSecretKey = GenKey.generateDefaultPsw();
|
superSecretKey = GenKey.generateDefaultPsw();
|
||||||
} else {
|
} else {
|
||||||
System.out.println("AES key-exchange unknown username");
|
System.err.println("AES key-exchange unknown username");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
byte[] md5 = md5Digest(nonce + ":" + superSecretKey);
|
byte[] md5 = md5Digest(nonce + ":" + superSecretKey);
|
||||||
|
|
|
@ -30,19 +30,19 @@ class Args(parser: ArgParser) {
|
||||||
fun main(args: Array<String>) = mainBody {
|
fun main(args: Array<String>) = mainBody {
|
||||||
ArgParser(args).parseInto(::Args).run {
|
ArgParser(args).parseInto(::Args).run {
|
||||||
if (keyExchange == null && nonce == null) {
|
if (keyExchange == null && nonce == null) {
|
||||||
println("Either the Key-Exchange or the nonce must be provided!")
|
System.err.println("Either the Key-Exchange or the nonce must be provided!")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
if (cloudPassword == null) {
|
if (cloudPassword == null) {
|
||||||
println("Cloud password not provided, using the default one for unprovisioned cameras")
|
System.err.println("Cloud password not provided, using the default one for unprovisioned cameras")
|
||||||
}
|
}
|
||||||
if (isatty(STDIN_FILENO) == 1) {
|
if (isatty(STDIN_FILENO) == 1) {
|
||||||
println("Data to ${if (encrypt) "encrypt" else "decrypt"} must be sent to standard input!")
|
System.err.println("Data to ${if (encrypt) "encrypt" else "decrypt"} must be sent to standard input!")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
val toProcess = System.`in`.readAllBytesCompat()
|
val toProcess = System.`in`.readAllBytesCompat()
|
||||||
if (toProcess == null) {
|
if (toProcess == null) {
|
||||||
println("Unable to read data from stdin!")
|
System.err.println("Unable to read data from stdin!")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue