directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject [4/4] directory-kerberos git commit: Fixed some issues
Date Sun, 25 Jan 2015 04:13:36 GMT
Fixed some issues


Project: http://git-wip-us.apache.org/repos/asf/directory-kerberos/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerberos/commit/94e3ac5b
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerberos/tree/94e3ac5b
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerberos/diff/94e3ac5b

Branch: refs/heads/cleanpki
Commit: 94e3ac5be945f524c810adaa4ee4a55121ac24a1
Parents: e95b711
Author: Drankye <drankye@gmail.com>
Authored: Sun Jan 25 12:12:56 2015 +0800
Committer: Drankye <drankye@gmail.com>
Committed: Sun Jan 25 12:12:56 2015 +0800

----------------------------------------------------------------------
 .../org/apache/commons/ssl/Asn1PkcsUtil.java    | 22 +++++++++++++++-----
 .../org/apache/kerby/asn1/type/Asn1Simple.java  |  3 ++-
 2 files changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/94e3ac5b/3rdparty/not-yet-commons-ssl/src/main/java/org/apache/commons/ssl/Asn1PkcsUtil.java
----------------------------------------------------------------------
diff --git a/3rdparty/not-yet-commons-ssl/src/main/java/org/apache/commons/ssl/Asn1PkcsUtil.java
b/3rdparty/not-yet-commons-ssl/src/main/java/org/apache/commons/ssl/Asn1PkcsUtil.java
index db47c5a..1e17099 100644
--- a/3rdparty/not-yet-commons-ssl/src/main/java/org/apache/commons/ssl/Asn1PkcsUtil.java
+++ b/3rdparty/not-yet-commons-ssl/src/main/java/org/apache/commons/ssl/Asn1PkcsUtil.java
@@ -52,13 +52,17 @@ public class Asn1PkcsUtil {
     public static Asn1PkcsStructure analyze(byte[] asn1)
             throws IOException {
         Asn1InputBuffer asn = new Asn1InputBuffer(asn1);
-        Asn1Type asn1Obj = asn.read();
+        Asn1Type asn1Obj;
+
         Asn1PkcsStructure pkcs8 = new Asn1PkcsStructure();
-        if (asn1Obj instanceof Asn1Collection) {
-            Asn1PkcsUtil.analyze((Asn1Collection) asn1Obj, pkcs8, 0);
-        } else {
-            Asn1PkcsUtil.analyze(asn1Obj, pkcs8, 0);
+        while ((asn1Obj = asn.read()) != null) {
+            if (asn1Obj instanceof Asn1Collection) {
+                Asn1PkcsUtil.analyze((Asn1Collection) asn1Obj, pkcs8, 0);
+            } else {
+                Asn1PkcsUtil.analyze(asn1Obj, pkcs8, 0);
+            }
         }
+
         return pkcs8;
     }
 
@@ -102,6 +106,14 @@ public class Asn1PkcsUtil {
             if (pkcs8.derIntegers != null) {
                 pkcs8.derIntegers.add(new Asn1BigInteger(dInt.getValue()));
             }
+            int intValue = dInt.getValue();
+            if (intValue > 0) {
+                if (pkcs8.iterationCount == 0) {
+                    pkcs8.iterationCount = intValue;
+                } else if (pkcs8.keySize == 0) {
+                    pkcs8.keySize = intValue;
+                }
+            }
         } else if (obj instanceof Asn1BigInteger) {
             Asn1BigInteger dInt = (Asn1BigInteger) obj;
             if (pkcs8.derIntegers != null) {

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/94e3ac5b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java
index 11296be..4464000 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java
@@ -166,7 +166,8 @@ public abstract class Asn1Simple<T> extends AbstractAsn1Type<T>
{
             case IA5_STRING:
                 return new Asn1IA5String();
             case INTEGER:
-                return new Asn1Integer();
+                // instead of Asn1Integer, for safe in case large number
+                return new Asn1BigInteger();
             case NULL:
                 return Asn1Null.INSTANCE;
             case NUMERIC_STRING:


Mime
View raw message