cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: Moving MessageDigestUtils back to the original package
Date Wed, 14 May 2014 10:20:52 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 3bd1723a6 -> 6afbf9c60


Moving MessageDigestUtils back to the original package


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/6afbf9c6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6afbf9c6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6afbf9c6

Branch: refs/heads/master
Commit: 6afbf9c60263c3f3d34f64f609f3b42c33cd5141
Parents: 3bd1723
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed May 14 11:20:33 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed May 14 11:20:33 2014 +0100

----------------------------------------------------------------------
 .../oauth2/grants/code/DigestCodeVerifier.java  |  2 +-
 .../oauth2/utils/MessageDigestUtils.java        | 80 ++++++++++++++++++++
 .../rs/security/oauth2/utils/OAuthUtils.java    |  1 -
 .../oauth2/utils/crypto/CryptoUtils.java        |  2 +-
 .../oauth2/utils/crypto/MessageDigestUtils.java | 80 --------------------
 5 files changed, 82 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6afbf9c6/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/DigestCodeVerifier.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/DigestCodeVerifier.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/DigestCodeVerifier.java
index 60597c5..1918597 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/DigestCodeVerifier.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/DigestCodeVerifier.java
@@ -19,7 +19,7 @@
 package org.apache.cxf.rs.security.oauth2.grants.code;
 
 import org.apache.cxf.rs.security.oauth2.utils.Base64UrlUtility;
-import org.apache.cxf.rs.security.oauth2.utils.crypto.MessageDigestUtils;
+import org.apache.cxf.rs.security.oauth2.utils.MessageDigestUtils;
 
 public class DigestCodeVerifier implements CodeVerifierTransformer {
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/6afbf9c6/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/MessageDigestUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/MessageDigestUtils.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/MessageDigestUtils.java
new file mode 100644
index 0000000..5a2d18a
--- /dev/null
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/MessageDigestUtils.java
@@ -0,0 +1,80 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.rs.security.oauth2.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
+
+/**
+ * The utility Message Digest generator which can be used for generating
+ * random values
+ */
+public final class MessageDigestUtils {
+    
+    public static final String ALGO_SHA_1 = "SHA-1";
+    public static final String ALGO_SHA_256 = "SHA-256";
+    public static final String ALGO_MD5 = "MD5";
+    
+    private MessageDigestUtils() {
+        
+    }
+        
+    public static String generate(byte[] input) throws OAuthServiceException {
+        return generate(input, ALGO_MD5);
+    }   
+    
+    public static String generate(byte[] input, String algo) throws OAuthServiceException
{    
+        if (input == null) {
+            throw new OAuthServiceException("You have to pass input to Token Generator");
+        }
+
+        try {
+            byte[] messageDigest = createDigest(input, algo);
+            StringBuffer hexString = new StringBuffer();
+            for (int i = 0; i < messageDigest.length; i++) {
+                hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
+            }
+
+            return hexString.toString();
+        } catch (NoSuchAlgorithmException e) {
+            throw new OAuthServiceException("server_error", e);
+        }
+    }
+
+    public static byte[] createDigest(String input, String algo) {
+        try {
+            return createDigest(input.getBytes("UTF-8"), algo);
+        } catch (UnsupportedEncodingException e) {
+            throw new OAuthServiceException("server_error", e);
+        } catch (NoSuchAlgorithmException e) {
+            throw new OAuthServiceException("server_error", e);
+        }   
+    }
+    
+    public static byte[] createDigest(byte[] input, String algo) throws NoSuchAlgorithmException
{ 
+        MessageDigest md = MessageDigest.getInstance(algo);
+        md.reset();
+        md.update(input);
+        return md.digest();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/6afbf9c6/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
index 09aa0d0..cd5075a 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
@@ -35,7 +35,6 @@ import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
-import org.apache.cxf.rs.security.oauth2.utils.crypto.MessageDigestUtils;
 import org.apache.cxf.security.LoginSecurityContext;
 import org.apache.cxf.security.SecurityContext;
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/6afbf9c6/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
index 16dc0e1..410b56e 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtils.java
@@ -68,7 +68,7 @@ public final class CryptoUtils {
         return encodeBytes(encryptedBytes);
     }
     
-    public static RSAPublicKey getRsaPublicKey(String encodedModulus,
+    public static RSAPublicKey getRSAPublicKey(String encodedModulus,
                                                String encodedPublicExponent) {
         try {
             return getRSAPublicKey(Base64UrlUtility.decode(encodedModulus),

http://git-wip-us.apache.org/repos/asf/cxf/blob/6afbf9c6/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/MessageDigestUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/MessageDigestUtils.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/MessageDigestUtils.java
deleted file mode 100644
index 78058b7..0000000
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/crypto/MessageDigestUtils.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * 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.
- */
-package org.apache.cxf.rs.security.oauth2.utils.crypto;
-
-import java.io.UnsupportedEncodingException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
-
-/**
- * The utility Message Digest generator which can be used for generating
- * random values
- */
-public final class MessageDigestUtils {
-    
-    public static final String ALGO_SHA_1 = "SHA-1";
-    public static final String ALGO_SHA_256 = "SHA-256";
-    public static final String ALGO_MD5 = "MD5";
-    
-    private MessageDigestUtils() {
-        
-    }
-        
-    public static String generate(byte[] input) throws OAuthServiceException {
-        return generate(input, ALGO_MD5);
-    }   
-    
-    public static String generate(byte[] input, String algo) throws OAuthServiceException
{    
-        if (input == null) {
-            throw new OAuthServiceException("You have to pass input to Token Generator");
-        }
-
-        try {
-            byte[] messageDigest = createDigest(input, algo);
-            StringBuffer hexString = new StringBuffer();
-            for (int i = 0; i < messageDigest.length; i++) {
-                hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
-            }
-
-            return hexString.toString();
-        } catch (NoSuchAlgorithmException e) {
-            throw new OAuthServiceException("server_error", e);
-        }
-    }
-
-    public static byte[] createDigest(String input, String algo) {
-        try {
-            return createDigest(input.getBytes("UTF-8"), algo);
-        } catch (UnsupportedEncodingException e) {
-            throw new OAuthServiceException("server_error", e);
-        } catch (NoSuchAlgorithmException e) {
-            throw new OAuthServiceException("server_error", e);
-        }   
-    }
-    
-    public static byte[] createDigest(byte[] input, String algo) throws NoSuchAlgorithmException
{ 
-        MessageDigest md = MessageDigest.getInstance(algo);
-        md.reset();
-        md.update(input);
-        return md.digest();
-    }
-    
-}


Mime
View raw message