directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dran...@apache.org
Subject directory-kerby git commit: PKINIT. Simplified some codes
Date Sat, 26 Dec 2015 01:54:00 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master e1b5aaacd -> 770615731


PKINIT. Simplified some codes


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

Branch: refs/heads/master
Commit: 7706157311322bac5835369828c10a1ee21136cf
Parents: e1b5aaa
Author: Kai Zheng <kai.zheng@intel.com>
Authored: Sat Dec 26 09:53:41 2015 +0800
Committer: Kai Zheng <kai.zheng@intel.com>
Committed: Sat Dec 26 09:53:41 2015 +0800

----------------------------------------------------------------------
 .../apache/kerby/asn1/type/Asn1CollectionType.java    | 14 +++++++++++++-
 .../kerb/client/preauth/pkinit/PkinitPreauth.java     |  2 +-
 .../kerberos/kerb/preauth/pkinit/PkinitCrypto.java    | 10 +++++-----
 .../kerb/preauth/pkinit/PkinitPlgCryptoContext.java   | 13 ++++++-------
 .../kerby/kerberos/kerb/codec/TestPaPkAsRep.java      |  3 +--
 .../kerb/codec/TestPkinitAnonymousAsRepCodec.java     |  2 +-
 .../kerb/codec/TestPkinitAnonymousAsReqCodec.java     |  4 ++--
 .../kerberos/kerb/codec/TestPkinitRsaAsRepCodec.java  |  4 ++--
 .../kerberos/kerb/codec/TestPkinitRsaAsReqCodec.java  |  4 ++--
 .../kerb/server/preauth/pkinit/PkinitPreauth.java     |  3 +--
 .../java/org/apache/kerby/cms/type/ContentInfo.java   |  8 ++++----
 .../kerby/cms/type/EncapsulatedContentInfo.java       |  4 ++--
 .../java/org/apache/kerby/x509/type/DHParameter.java  |  6 +++---
 .../java/org/apache/kerby/cms/TestSignedData.java     |  5 ++---
 14 files changed, 45 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
index 16e40b3..8f546c6 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
@@ -228,10 +228,22 @@ public abstract class Asn1CollectionType
         setFieldAs(index, new Asn1Integer(value));
     }
 
-    protected void setFieldAsBigInteger(EnumType index, BigInteger value) {
+    protected void setFieldAsInt(EnumType index, BigInteger value) {
         setFieldAs(index, new Asn1Integer(value));
     }
 
+    protected void setFieldAsObjId(EnumType index, String value) {
+        setFieldAs(index, new Asn1ObjectIdentifier(value));
+    }
+
+    protected String getFieldAsObjId(EnumType index) {
+        Asn1ObjectIdentifier objId = getFieldAs(index, Asn1ObjectIdentifier.class);
+        if (objId != null) {
+            return objId.getValue();
+        }
+        return null;
+    }
+
     protected <T extends Asn1Type> T getFieldAsAny(EnumType index, Class<T> t)
{
         Asn1Type value = fields[index.getValue()];
         if (value != null && value instanceof Asn1Any) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
index 179d215..dc6e262 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
@@ -293,7 +293,7 @@ public class PkinitPreauth extends AbstractPreauthPlugin {
 
     private byte[] signAuthPack(AuthPack authPack) throws KrbException {
 
-        Asn1ObjectIdentifier oid = pkinitContext.cryptoctx.getIdPkinitAuthDataOID();
+        String oid = pkinitContext.cryptoctx.getIdPkinitAuthDataOID();
 
         byte[] signedDataBytes = PkinitCrypto.cmsSignedDataCreate(
             KrbCodec.encode(authPack), oid, 3, null, null, null, null);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitCrypto.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitCrypto.java
b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitCrypto.java
index e9cca99..389f29c 100644
--- a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitCrypto.java
+++ b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitCrypto.java
@@ -65,13 +65,13 @@ public class PkinitCrypto {
      */
     public static void verifyCMSSignedData(CMSMessageType cmsMsgType, SignedData signedData)
             throws KrbException {
-        Asn1ObjectIdentifier oid = pkinitType2OID(cmsMsgType);
+        String oid = pkinitType2OID(cmsMsgType);
         if (oid == null) {
             throw new KrbException("Can't get the right oid ");
         }
 
         Asn1ObjectIdentifier etype = signedData.getEncapContentInfo().getContentType();
-        if (oid.getValue().equals(etype.getValue())) {
+        if (oid.equals(etype.getValue())) {
             LOG.info("CMS Verification successful");
         } else {
             LOG.error("Wrong oid in eContentType");
@@ -98,7 +98,7 @@ public class PkinitCrypto {
      * @param cmsMsgType The CMS message type
      * @return oid
      */
-    public static Asn1ObjectIdentifier pkinitType2OID(CMSMessageType cmsMsgType) {
+    public static String pkinitType2OID(CMSMessageType cmsMsgType) {
         switch (cmsMsgType) {
             case UNKNOWN:
                 return null;
@@ -221,12 +221,12 @@ public class PkinitCrypto {
      * @param signerInfos The signerInfos
      * @return The encoded ContentInfo
      */
-    public static byte[] cmsSignedDataCreate(byte[] data, Asn1ObjectIdentifier oid, int version,
+    public static byte[] cmsSignedDataCreate(byte[] data, String oid, int version,
                                              DigestAlgorithmIdentifiers digestAlgorithmIdentifiers,
                                              CertificateSet certificateSet,
                                              RevocationInfoChoices crls, SignerInfos signerInfos)
throws KrbException {
         SignedContentInfo contentInfo = new SignedContentInfo();
-        contentInfo.setContentType(new Asn1ObjectIdentifier("1.2.840.113549.1.7.2"));
+        contentInfo.setContentType("1.2.840.113549.1.7.2");
         SignedData signedData = new SignedData();
         signedData.setVersion(version);
         if (digestAlgorithmIdentifiers != null) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitPlgCryptoContext.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitPlgCryptoContext.java
b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitPlgCryptoContext.java
index 23206db..6732b7d 100644
--- a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitPlgCryptoContext.java
+++ b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PkinitPlgCryptoContext.java
@@ -18,7 +18,6 @@
  */
 package org.apache.kerby.kerberos.kerb.preauth.pkinit;
 
-import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
 import org.apache.kerby.kerberos.kerb.KrbException;
 
 import javax.crypto.spec.DHParameterSpec;
@@ -134,15 +133,15 @@ public class PkinitPlgCryptoContext {
     }
 
 
-    public static Asn1ObjectIdentifier getIdPkinitAuthDataOID() {
-        return new Asn1ObjectIdentifier(ID_PKINIT_AUTHDATA);
+    public static String getIdPkinitAuthDataOID() {
+        return ID_PKINIT_AUTHDATA;
     }
 
-    public static Asn1ObjectIdentifier getIdPkinitDHKeyDataOID() {
-        return new Asn1ObjectIdentifier(ID_PKINIT_DHKEYDATA);
+    public static String getIdPkinitDHKeyDataOID() {
+        return ID_PKINIT_DHKEYDATA;
     }
 
-    public static Asn1ObjectIdentifier getIdPkinitRkeyDataOID() {
-        return new Asn1ObjectIdentifier(ID_PKINIT_RKEYDATA);
+    public static String getIdPkinitRkeyDataOID() {
+        return ID_PKINIT_RKEYDATA;
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPaPkAsRep.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPaPkAsRep.java
b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPaPkAsRep.java
index 53d7abf..9de4b61 100644
--- a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPaPkAsRep.java
+++ b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPaPkAsRep.java
@@ -20,7 +20,6 @@
 package org.apache.kerby.kerberos.kerb.codec;
 
 import org.apache.kerby.asn1.Asn1;
-import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
 import org.apache.kerby.cms.type.ContentInfo;
 import org.apache.kerby.kerberos.kerb.KrbCodec;
 import org.apache.kerby.kerberos.kerb.KrbException;
@@ -37,7 +36,7 @@ public class TestPaPkAsRep {
         PaPkAsRep paPkAsRep = new PaPkAsRep();
         DHRepInfo dhRepInfo = new DHRepInfo();
         ContentInfo contentInfo = new ContentInfo();
-        contentInfo.setContentType(new Asn1ObjectIdentifier("1.2.840.113549.1.7.2"));
+        contentInfo.setContentType("1.2.840.113549.1.7.2");
         dhRepInfo.setDHSignedData(contentInfo.encode());
         paPkAsRep.setDHRepInfo(dhRepInfo);
         Asn1.parseAndDump(paPkAsRep.encode());

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsRepCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsRepCodec.java
b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsRepCodec.java
index a67bb2c..6d41628 100644
--- a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsRepCodec.java
+++ b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsRepCodec.java
@@ -106,7 +106,7 @@ public class TestPkinitAnonymousAsRepCodec {
         byte[] dhSignedData = dhRepInfo.getDHSignedData();
         SignedContentInfo contentInfo = new SignedContentInfo();
         contentInfo.decode(dhSignedData);
-        assertThat(contentInfo.getContentType().getValue()).isEqualTo("1.2.840.113549.1.7.2");
+        assertThat(contentInfo.getContentType()).isEqualTo("1.2.840.113549.1.7.2");
         SignedData signedData = contentInfo.getContentAs(SignedData.class);
         assertThat(signedData.getCertificates()).isNotNull();
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
index a6c7733..f5a2de8 100644
--- a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
+++ b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitAnonymousAsReqCodec.java
@@ -45,7 +45,7 @@ import java.text.ParseException;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.*;
 
 public class TestPkinitAnonymousAsReqCodec {
     @Test
@@ -114,7 +114,7 @@ public class TestPkinitAnonymousAsReqCodec {
         SignedContentInfo contentInfo = new SignedContentInfo();
         Asn1.parseAndDump(paPkAsReq.getSignedAuthPack());
         contentInfo.decode(paPkAsReq.getSignedAuthPack());
-        assertThat(contentInfo.getContentType().getValue()).isEqualTo("1.2.840.113549.1.7.2");
+        assertThat(contentInfo.getContentType()).isEqualTo("1.2.840.113549.1.7.2");
         Asn1.dump(contentInfo);
 
         SignedData signedData = contentInfo.getSignedData();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsRepCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsRepCodec.java
b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsRepCodec.java
index 0de845e..9e96cef 100644
--- a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsRepCodec.java
+++ b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsRepCodec.java
@@ -33,7 +33,7 @@ import org.junit.Test;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.*;
 
 public class TestPkinitRsaAsRepCodec {
     @Test
@@ -61,7 +61,7 @@ public class TestPkinitRsaAsRepCodec {
         Asn1.parseAndDump(encKeyPack);
         ContentInfo contentInfo = new ContentInfo();
         contentInfo.decode(encKeyPack);
-        assertThat(contentInfo.getContentType().getValue()).isEqualTo("1.2.840.113549.1.7.3");
+        assertThat(contentInfo.getContentType()).isEqualTo("1.2.840.113549.1.7.3");
         EnvelopedData envelopedData = contentInfo.getContentAs(EnvelopedData.class);
         Asn1.dump(envelopedData);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsReqCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsReqCodec.java
b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsReqCodec.java
index 0cb6ad4..d493979 100644
--- a/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsReqCodec.java
+++ b/kerby-kerb/kerb-core/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestPkinitRsaAsReqCodec.java
@@ -40,7 +40,7 @@ import java.text.ParseException;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.*;
 
 public class TestPkinitRsaAsReqCodec {
     @Test
@@ -71,7 +71,7 @@ public class TestPkinitRsaAsReqCodec {
         ContentInfo contentInfo = new ContentInfo();
         //Asn1.parseAndDump(paPkAsReq.getSignedAuthPack());
         contentInfo.decode(paPkAsReq.getSignedAuthPack());
-        assertThat(contentInfo.getContentType().getValue()).isEqualTo("1.2.840.113549.1.7.2");
+        assertThat(contentInfo.getContentType()).isEqualTo("1.2.840.113549.1.7.2");
         //Asn1.dump(contentInfo);
 
         SignedData signedData = contentInfo.getContentAs(SignedData.class);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/preauth/pkinit/PkinitPreauth.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/preauth/pkinit/PkinitPreauth.java
b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/preauth/pkinit/PkinitPreauth.java
index 86d0a61..a357486 100644
--- a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/preauth/pkinit/PkinitPreauth.java
+++ b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/preauth/pkinit/PkinitPreauth.java
@@ -23,7 +23,6 @@ import org.apache.kerby.asn1.Asn1;
 import org.apache.kerby.asn1.parse.Asn1Container;
 import org.apache.kerby.asn1.parse.Asn1ParseResult;
 import org.apache.kerby.asn1.type.Asn1Integer;
-import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
 import org.apache.kerby.cms.type.CertificateChoices;
 import org.apache.kerby.cms.type.CertificateSet;
 import org.apache.kerby.cms.type.ContentInfo;
@@ -341,7 +340,7 @@ public class PkinitPreauth extends AbstractPreauthPlugin {
             certificateSet.addElement(certificateChoices);
         }
 
-        Asn1ObjectIdentifier oid = cryptoContext.getIdPkinitDHKeyDataOID();
+        String oid = cryptoContext.getIdPkinitDHKeyDataOID();
         signedDataBytes = PkinitCrypto.cmsSignedDataCreate(KrbCodec.encode(kdcDhKeyInfo),
oid, 3, null,
                 null, null, null);
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java
index 077abe2..5037efa 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java
@@ -66,12 +66,12 @@ public class ContentInfo extends Asn1SequenceType {
         super(fieldInfos);
     }
 
-    public Asn1ObjectIdentifier getContentType() {
-        return getFieldAs(CONTENT_TYPE, Asn1ObjectIdentifier.class);
+    public String getContentType() {
+        return getFieldAsObjId(CONTENT_TYPE);
     }
 
-    public void setContentType(Asn1ObjectIdentifier contentType) {
-        setFieldAs(CONTENT_TYPE, contentType);
+    public void setContentType(String contentType) {
+        setFieldAsObjId(CONTENT_TYPE, contentType);
     }
 
     public <T extends Asn1Type> T getContentAs(Class<T> t) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java
b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java
index 17b5c76..2a51273 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java
@@ -65,8 +65,8 @@ public class EncapsulatedContentInfo extends Asn1SequenceType {
         return getFieldAs(CONTENT_TYPE, Asn1ObjectIdentifier.class);
     }
 
-    public void setContentType(Asn1ObjectIdentifier contentType) {
-        setFieldAs(CONTENT_TYPE, contentType);
+    public void setContentType(String contentType) {
+        setFieldAsObjId(CONTENT_TYPE, contentType);
     }
 
     public byte[] getContent() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java
index beb9474..551c0c3 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java
@@ -37,7 +37,7 @@ public class DHParameter extends Asn1SequenceType {
     }
 
     public void setP(BigInteger p) {
-        setFieldAsBigInteger(P, p);
+        setFieldAsInt(P, p);
     }
 
     public BigInteger getP() {
@@ -46,7 +46,7 @@ public class DHParameter extends Asn1SequenceType {
     }
 
     public void setG(BigInteger g) {
-        setFieldAsBigInteger(G, g);
+        setFieldAsInt(G, g);
     }
 
     public BigInteger getG() {
@@ -55,7 +55,7 @@ public class DHParameter extends Asn1SequenceType {
     }
 
     public void setQ(BigInteger q) {
-        setFieldAsBigInteger(Q, q);
+        setFieldAsInt(Q, q);
     }
 
     public BigInteger getQ() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/77061573/kerby-pkix/src/test/java/org/apache/kerby/cms/TestSignedData.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/test/java/org/apache/kerby/cms/TestSignedData.java b/kerby-pkix/src/test/java/org/apache/kerby/cms/TestSignedData.java
index 18d452e..ab85e93 100644
--- a/kerby-pkix/src/test/java/org/apache/kerby/cms/TestSignedData.java
+++ b/kerby-pkix/src/test/java/org/apache/kerby/cms/TestSignedData.java
@@ -20,7 +20,6 @@
 package org.apache.kerby.cms;
 
 import org.apache.kerby.asn1.Asn1;
-import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
 import org.apache.kerby.cms.type.CertificateChoices;
 import org.apache.kerby.cms.type.CertificateSet;
 import org.apache.kerby.cms.type.ContentInfo;
@@ -61,10 +60,10 @@ public class TestSignedData extends CmsTestBase {
     @Test
     public void testEncoding() throws IOException {
         SignedContentInfo contentInfo = new SignedContentInfo();
-        contentInfo.setContentType(new Asn1ObjectIdentifier("1.2.840.113549.1.7.2"));
+        contentInfo.setContentType("1.2.840.113549.1.7.2");
         SignedData signedData = new SignedData();
         EncapsulatedContentInfo eContentInfo = new EncapsulatedContentInfo();
-        eContentInfo.setContentType(new Asn1ObjectIdentifier("1.3.6.1.5.2.3.1"));
+        eContentInfo.setContentType("1.3.6.1.5.2.3.1");
         eContentInfo.setContent("data".getBytes());
         signedData.setEncapContentInfo(eContentInfo);
 


Mime
View raw message