Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 56391200B39 for ; Fri, 24 Jun 2016 10:36:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 553D8160A62; Fri, 24 Jun 2016 08:36:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7CBA3160A5A for ; Fri, 24 Jun 2016 10:36:18 +0200 (CEST) Received: (qmail 46396 invoked by uid 500); 24 Jun 2016 08:36:17 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 46217 invoked by uid 99); 24 Jun 2016 08:36:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jun 2016 08:36:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 18EE5E07F6; Fri, 24 Jun 2016 08:36:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sdp@apache.org To: commits@commons.apache.org Date: Fri, 24 Jun 2016 08:36:18 -0000 Message-Id: <358adaad15de4d5f879774db963f1c6b@git.apache.org> In-Reply-To: <096f7fe268ac4ee19e2eb8d9bf11d3b2@git.apache.org> References: <096f7fe268ac4ee19e2eb8d9bf11d3b2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] commons-crypto git commit: Fix check style archived-at: Fri, 24 Jun 2016 08:36:19 -0000 Fix check style Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/49a26471 Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/49a26471 Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/49a26471 Branch: refs/heads/master Commit: 49a264718f4511ce272260082315e223d1a4615c Parents: 1298881 Author: Sun Dapeng Authored: Fri Jun 24 16:32:08 2016 +0800 Committer: Sun Dapeng Committed: Fri Jun 24 16:32:08 2016 +0800 ---------------------------------------------------------------------- .../commons/crypto/cipher/OpensslCipher.java | 2 +- .../crypto/examples/CipherByteArrayExample.java | 12 +++++++++++ .../examples/CipherByteBufferExample.java | 18 ++++++++++++++++ .../commons/crypto/examples/RandomExample.java | 7 +++++++ .../commons/crypto/examples/StreamExample.java | 12 +++++++++++ .../commons/crypto/examples/package-info.java | 22 ++++++++++++++++++++ .../org/apache/commons/crypto/package-info.java | 22 ++++++++++++++++++++ .../commons/crypto/utils/package-info.java | 2 +- 8 files changed, 95 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java b/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java index 1cfd3e8..ab088eb 100644 --- a/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java +++ b/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java @@ -50,7 +50,7 @@ public class OpensslCipher implements CryptoCipher { * @param transformation transformation for OpenSSL cipher * @throws GeneralSecurityException if OpenSSL cipher initialize failed */ - public OpensslCipher(Properties props, String transformation) + public OpensslCipher(Properties props, String transformation) // NOPMD throws GeneralSecurityException { this.transformation = transformation; http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java b/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java index a0a6ea0..e90a876 100644 --- a/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java +++ b/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java @@ -30,10 +30,22 @@ import org.apache.commons.crypto.utils.Utils; public class CipherByteArrayExample { + /** + * Converts String to UTF8 bytes + * + * @param input the input string + * @return UTF8 bytes + */ private static byte[] getUTF8Bytes(String input) { return input.getBytes(StandardCharsets.UTF_8); } + /** + * Main method + * + * @param args args of main + * @throws Exception when encryption/decryption failed + */ public static void main(String[] args) throws Exception { final SecretKeySpec key = new SecretKeySpec(getUTF8Bytes("1234567890123456"),"AES"); final IvParameterSpec iv = new IvParameterSpec(getUTF8Bytes("1234567890123456")); http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java b/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java index e614a6c..d804975 100644 --- a/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java +++ b/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java @@ -31,10 +31,22 @@ import org.apache.commons.crypto.utils.Utils; public class CipherByteBufferExample { + /** + * Converts String to UTF8 bytes + * + * @param input the input string + * @return UTF8 bytes + */ private static byte[] getUTF8Bytes(String input) { return input.getBytes(StandardCharsets.UTF_8); } + /** + * Converts ByteBuffer to String + * + * @param buffer input byte buffer + * @return the converted string + */ private static String asString(ByteBuffer buffer) { final ByteBuffer copy = buffer.duplicate(); final byte[] bytes = new byte[Math.min(copy.remaining(),50)]; @@ -42,6 +54,12 @@ public class CipherByteBufferExample { return new String(bytes, StandardCharsets.UTF_8); } + /** + * Main method + * + * @param args args of main + * @throws Exception when encryption/decryption failed + */ public static void main(String[] args) throws Exception { final SecretKeySpec key = new SecretKeySpec(getUTF8Bytes("1234567890123456"), "AES"); final IvParameterSpec iv = new IvParameterSpec(getUTF8Bytes("1234567890123456")); http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/RandomExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/RandomExample.java b/src/main/java/org/apache/commons/crypto/examples/RandomExample.java index a350d7f..7e0c220 100644 --- a/src/main/java/org/apache/commons/crypto/examples/RandomExample.java +++ b/src/main/java/org/apache/commons/crypto/examples/RandomExample.java @@ -28,6 +28,13 @@ import org.apache.commons.crypto.random.CryptoRandomFactory; public class RandomExample { + /** + * Main method + * + * @param args args of main + * @throws GeneralSecurityException when encryption/decryption failed + * @throws IOException when io failed + */ public static void main(String []args) throws GeneralSecurityException, IOException { //Constructs a byte array to store random data. byte[] key = new byte[16]; http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/StreamExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/StreamExample.java b/src/main/java/org/apache/commons/crypto/examples/StreamExample.java index 8904cb1..b92ffca 100644 --- a/src/main/java/org/apache/commons/crypto/examples/StreamExample.java +++ b/src/main/java/org/apache/commons/crypto/examples/StreamExample.java @@ -36,10 +36,22 @@ import org.apache.commons.crypto.stream.CryptoOutputStream; */ public class StreamExample { + /** + * Converts String to UTF8 bytes + * + * @param input the input string + * @return UTF8 bytes + */ private static byte[] getUTF8Bytes(String input) { return input.getBytes(StandardCharsets.UTF_8); } + /** + * Main method + * + * @param args args of main + * @throws IOException when stream encryption/decryption failed + */ public static void main(String []args) throws IOException { final SecretKeySpec key = new SecretKeySpec(getUTF8Bytes("1234567890123456"),"AES"); final IvParameterSpec iv = new IvParameterSpec(getUTF8Bytes("1234567890123456")); http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/package-info.java b/src/main/java/org/apache/commons/crypto/examples/package-info.java new file mode 100644 index 0000000..6f9c541 --- /dev/null +++ b/src/main/java/org/apache/commons/crypto/examples/package-info.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Example classes + */ +package org.apache.commons.crypto.examples; http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/package-info.java b/src/main/java/org/apache/commons/crypto/package-info.java new file mode 100644 index 0000000..f7434c1 --- /dev/null +++ b/src/main/java/org/apache/commons/crypto/package-info.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Crypto classes + */ +package org.apache.commons.crypto; http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/utils/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/utils/package-info.java b/src/main/java/org/apache/commons/crypto/utils/package-info.java index 20785f2..060117e 100644 --- a/src/main/java/org/apache/commons/crypto/utils/package-info.java +++ b/src/main/java/org/apache/commons/crypto/utils/package-info.java @@ -15,8 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** * Utils classes */ package org.apache.commons.crypto.utils; -