本文整理汇总了Java中org.apache.harmony.security.x509.GeneralNames.addName方法的典型用法代码示例。如果您正苦于以下问题:Java GeneralNames.addName方法的具体用法?Java GeneralNames.addName怎么用?Java GeneralNames.addName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.harmony.security.x509.GeneralNames
的用法示例。
在下文中一共展示了GeneralNames.addName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testORAddress
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* ORAddress() method testing.
*/
public void testORAddress() {
ORAddress ora = new ORAddress();
System.out.println("");
System.out.println("ORAddress:");
printAsHex(8, "", " ", ora.getEncoded());
System.out.println("");
GeneralName gName = new GeneralName(ora);
System.out.println("GeneralName:");
printAsHex(8, "", " ", gName.getEncoded());
System.out.println("");
GeneralNames gNames = new GeneralNames();
gNames.addName(gName);
System.out.println("GeneralNames:");
printAsHex(8, "", " ", gNames.getEncoded());
System.out.println("");
}
示例2: testORAddress
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* ORAddress() method testing.
*/
public void testORAddress() {
try {
ORAddress ora = new ORAddress();
System.out.println("");
System.out.println("ORAddress:");
printAsHex(8, "", " ", ora.getEncoded());
System.out.println("");
GeneralName gName = new GeneralName(ora);
System.out.println("GeneralName:");
printAsHex(8, "", " ", gName.getEncoded());
System.out.println("");
GeneralNames gNames = new GeneralNames();
gNames.addName(gName);
System.out.println("GeneralNames:");
printAsHex(8, "", " ", gNames.getEncoded());
System.out.println("");
} catch (Exception e) {
e.printStackTrace();
fail("Exception was thrown.");
}
}
示例3: test_getSubjectAlternativeNames
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* @tests java.security.cert.X509CertSelector#getSubjectAlternativeNames()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getSubjectAlternativeNames",
args = {}
)
public void test_getSubjectAlternativeNames() {
try {
GeneralName san1 = new GeneralName(1, "[email protected]");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralNames sans = new GeneralNames();
sans.addName(san1);
sans.addName(san2);
TestCert cert_1 = new TestCert(sans);
X509CertSelector selector = new X509CertSelector();
assertNull("Selector should return null", selector
.getSubjectAlternativeNames());
selector.setSubjectAlternativeNames(sans.getPairsList());
assertTrue("The certificate should match the selection criteria.",
selector.match(cert_1));
selector.getSubjectAlternativeNames().clear();
assertTrue("The modification of initialization object "
+ "should not affect the modification "
+ "of internal object.", selector.match(cert_1));
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
}
示例4: test_addSubjectAlternativeNameLintLjava_lang_String2
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* @tests java.security.cert.X509CertSelector#addSubjectAlternativeName(int, String)
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "addSubjectAlternativeName",
args = {int.class, java.lang.String.class}
)
public void test_addSubjectAlternativeNameLintLjava_lang_String2() throws Exception{
GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralNames sans1 = new GeneralNames();
sans1.addName(san6);
sans1.addName(san2);
X509CertSelector selector = new X509CertSelector();
selector.addSubjectAlternativeName(6, "http://uniform.Resource.Id");
selector.addSubjectAlternativeName(2, "dNSName");
GeneralNames sans2 = new GeneralNames();
sans2.addName(san2);
TestCert cert1 = new TestCert(sans1);
TestCert cert2 = new TestCert(sans2);
assertTrue(selector.match(cert1));
assertFalse(selector.match(cert2));
selector.setSubjectAlternativeNames(null);
GeneralName name = new GeneralName(new Name("O=Android"));
try {
selector.addSubjectAlternativeName(0, (name.toString()));
} catch (IOException e) {
// ok
}
}
示例5: testGeneralName
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
public void testGeneralName() {
try {
GeneralName san0 =
new GeneralName(new OtherName("1.2.3.4.5", new byte[] {1, 2, 0, 1}));
GeneralName san1 = new GeneralName(1, "[email protected]");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralName san3 = new GeneralName(new ORAddress());
GeneralName san4 = new GeneralName(new Name("O=Organization"));
GeneralName san5 =
new GeneralName(new EDIPartyName("assigner", "party"));
GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
GeneralName san7 = new GeneralName(7, "1.1.1.1");
GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");
GeneralNames sans_1 = new GeneralNames();
sans_1.addName(san0);
sans_1.addName(san1);
sans_1.addName(san2);
sans_1.addName(san3);
sans_1.addName(san4);
sans_1.addName(san5);
sans_1.addName(san6);
sans_1.addName(san7);
sans_1.addName(san8);
byte[] encoding = GeneralNames.ASN1.encode(sans_1);
GeneralNames.ASN1.decode(encoding);
} catch (Exception e) {
// should not be thrown:
// provided string representations are correct
e.printStackTrace();
}
}
示例6: testGetSubjectAlternativeNames
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* getSubjectAlternativeNames() method testing.
*/
public void testGetSubjectAlternativeNames() {
try {
GeneralName san1 = new GeneralName(1, "[email protected]");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralNames sans = new GeneralNames();
sans.addName(san1);
sans.addName(san2);
TestCert cert_1 = new TestCert(sans);
X509CertSelector selector = new X509CertSelector();
assertNull("Selector should return null",
selector.getSubjectAlternativeNames());
selector.setSubjectAlternativeNames(sans.getPairsList());
assertTrue("The certificate should match the selection criteria.",
selector.match(cert_1));
selector.getSubjectAlternativeNames().clear();
assertTrue("The modification of initialization object "
+ "should not affect the modification "
+ "of internal object.", selector.match(cert_1));
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
}
示例7: testSetMatchAllSubjectAltNames
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* setMatchAllSubjectAltNames(boolean matchAllNames) method testing.
*/
public void testSetMatchAllSubjectAltNames() {
try {
GeneralName san1 = new GeneralName(1, "[email protected]");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralNames sans_1 = new GeneralNames();
sans_1.addName(san1);
GeneralNames sans_2 = new GeneralNames();
sans_2.addName(san1);
sans_2.addName(san2);
TestCert cert = new TestCert(sans_1);
X509CertSelector selector = new X509CertSelector();
selector.setMatchAllSubjectAltNames(true);
selector.setSubjectAlternativeNames(sans_2.getPairsList());
assertFalse("Only certificate which contain all of the specified "
+ "subject alternative names should match.",
selector.match(cert));
selector.setMatchAllSubjectAltNames(false);
/*
assertTrue("The certificate which contain at least one of the "
+ "specified subject alternative names must match.",
selector.match(cert));
*/
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
}
示例8: test_getPathToNames
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* @tests java.security.cert.X509CertSelector#getPathToNames()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getPathToNames",
args = {}
)
public void test_getPathToNames() {
try {
GeneralName san0 = new GeneralName(new OtherName("1.2.3.4.5",
new byte[] { 1, 2, 0, 1 }));
GeneralName san1 = new GeneralName(1, "[email protected]");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralName san3 = new GeneralName(new ORAddress());
GeneralName san4 = new GeneralName(new Name("O=Organization"));
GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
GeneralName san7 = new GeneralName(7, "1.1.1.1");
GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");
GeneralNames sans1 = new GeneralNames();
sans1.addName(san0);
sans1.addName(san1);
sans1.addName(san2);
sans1.addName(san3);
sans1.addName(san4);
sans1.addName(san6);
sans1.addName(san7);
sans1.addName(san8);
GeneralNames sans2 = new GeneralNames();
sans2.addName(san0);
TestCert cert1 = new TestCert(sans1);
TestCert cert2 = new TestCert(sans2);
X509CertSelector selector = new X509CertSelector();
selector.setMatchAllSubjectAltNames(true);
selector.setPathToNames(null);
assertTrue("Any certificate should match in the case of null "
+ "subjectAlternativeNames criteria.", selector
.match(cert1)
&& selector.match(cert2));
Collection<List<?>> sans = sans1.getPairsList();
selector.setPathToNames(sans);
Collection<List<?>> col = selector.getPathToNames();
Iterator<List<?>> i = col.iterator();
while (i.hasNext()) {
Object o = i.next();
if (!(o instanceof List)) {
fail("expected a List");
}
}
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
}
示例9: test_setPathToNamesLjava_util_Collection
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* @tests java.security.cert.X509CertSelector#setPathToNames(Collection<List<?>>)
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "setPathToNames",
args = {java.util.Collection.class}
)
public void test_setPathToNamesLjava_util_Collection() {
try {
GeneralName san0 = new GeneralName(new OtherName("1.2.3.4.5",
new byte[] { 1, 2, 0, 1 }));
GeneralName san1 = new GeneralName(1, "[email protected]");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralName san3 = new GeneralName(new ORAddress());
GeneralName san4 = new GeneralName(new Name("O=Organization"));
GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
GeneralName san7 = new GeneralName(7, "1.1.1.1");
GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");
GeneralNames sans1 = new GeneralNames();
sans1.addName(san0);
sans1.addName(san1);
sans1.addName(san2);
sans1.addName(san3);
sans1.addName(san4);
sans1.addName(san6);
sans1.addName(san7);
sans1.addName(san8);
GeneralNames sans2 = new GeneralNames();
sans2.addName(san0);
TestCert cert1 = new TestCert(sans1);
TestCert cert2 = new TestCert(sans2);
X509CertSelector selector = new X509CertSelector();
selector.setMatchAllSubjectAltNames(true);
selector.setPathToNames(null);
assertTrue("Any certificate should match in the case of null "
+ "subjectAlternativeNames criteria.", selector
.match(cert1)
&& selector.match(cert2));
Collection<List<?>> sans = sans1.getPairsList();
selector.setPathToNames(sans);
Collection<List<?>> col = selector.getPathToNames();
Iterator<List<?>> i = col.iterator();
while (i.hasNext()) {
Object o = i.next();
if (!(o instanceof List)) {
fail("expected a List");
}
}
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
}
示例10: test_setSubjectAlternativeNamesLjava_util_Collection
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* @tests java.security.cert.X509CertSelector#setSubjectAlternativeNames(Collection<List<?>>)
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "setSubjectAlternativeNames",
args = {java.util.Collection.class}
)
public void test_setSubjectAlternativeNamesLjava_util_Collection() {
try {
GeneralName san0 = new GeneralName(new OtherName("1.2.3.4.5",
new byte[] { 1, 2, 0, 1 }));
GeneralName san1 = new GeneralName(1, "[email protected]");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralName san3 = new GeneralName(new ORAddress());
GeneralName san4 = new GeneralName(new Name("O=Organization"));
GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
GeneralName san7 = new GeneralName(7, "1.1.1.1");
GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");
GeneralNames sans1 = new GeneralNames();
sans1.addName(san0);
sans1.addName(san1);
sans1.addName(san2);
sans1.addName(san3);
sans1.addName(san4);
sans1.addName(san6);
sans1.addName(san7);
sans1.addName(san8);
GeneralNames sans2 = new GeneralNames();
sans2.addName(san0);
TestCert cert1 = new TestCert(sans1);
TestCert cert2 = new TestCert(sans2);
X509CertSelector selector = new X509CertSelector();
selector.setMatchAllSubjectAltNames(true);
selector.setSubjectAlternativeNames(null);
assertTrue("Any certificate should match in the case of null "
+ "subjectAlternativeNames criteria.", selector
.match(cert1)
&& selector.match(cert2));
Collection<List<?>> sans = sans1.getPairsList();
selector.setSubjectAlternativeNames(sans);
Collection<List<?>> col = selector.getSubjectAlternativeNames();
Iterator<List<?>> i = col.iterator();
while (i.hasNext()) {
Object o = i.next();
if (!(o instanceof List)) {
fail("expected a List");
}
}
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
}
示例11: test_addSubjectAlternativeNameLintLbyte_array2
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* @tests java.security.cert.X509CertSelector#addSubjectAlternativeName(int, byte[])
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "IOException checking missed",
method = "addSubjectAlternativeName",
args = {int.class, byte[].class}
)
public void test_addSubjectAlternativeNameLintLbyte_array2()
throws Exception {
GeneralName san0 = new GeneralName(new OtherName("1.2.3.4.5",
new byte[] {1, 2, 0, 1}));
GeneralName san1 = new GeneralName(1, "[email protected]");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralNames sans1 = new GeneralNames();
sans1.addName(san0);
sans1.addName(san1);
sans1.addName(san2);
X509CertSelector selector = new X509CertSelector();
selector.addSubjectAlternativeName(0, san0.getEncodedName());
selector.addSubjectAlternativeName(1, san1.getEncodedName());
selector.addSubjectAlternativeName(2, san2.getEncodedName());
GeneralNames sans2 = new GeneralNames();
sans2.addName(san0);
TestCert cert1 = new TestCert(sans1);
TestCert cert2 = new TestCert(sans2);
assertTrue(selector.match(cert1));
assertFalse(selector.match(cert2));
selector.setSubjectAlternativeNames(null);
GeneralName name = new GeneralName(new Name("O=Android"));
try {
selector.addSubjectAlternativeName(0, name.getEncodedName());
} catch (IOException e) {
// ok
}
}
示例12: _testEDIPartyName1
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* EDIPartyName(String nameAssigner, String partyName) method testing.
*/
public void _testEDIPartyName1() {
boolean pass = true;
EDIPartyName ediPN = new EDIPartyName("nameAssigner", "partyName");
byte[] encoded = ediPN.getEncoded();
// manually derived data:
byte[] _encoded = {
(byte) 0x30, (byte) 0x1d, (byte) 0x80, (byte) 0x0e,
(byte) 0x13, (byte) 0x0c, (byte) 0x6e, (byte) 0x61,
(byte) 0x6d, (byte) 0x65, (byte) 0x41, (byte) 0x73,
(byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e,
(byte) 0x65, (byte) 0x72, (byte) 0x81, (byte) 0x0b,
(byte) 0x13, (byte) 0x09, (byte) 0x70, (byte) 0x61,
(byte) 0x72, (byte) 0x74, (byte) 0x79, (byte) 0x4e,
(byte) 0x61, (byte) 0x6d, (byte) 0x65
};
if (!Arrays.equals(encoded, _encoded)) {
System.out.println("Got encoded form of EDIPartyName is:");
printAsHex(16, "", " ", encoded);
System.out.println("But should be like this:");
printAsHex(16, "", " ", _encoded);
System.out.println("");
pass = false;
}
GeneralName gName = new GeneralName(ediPN);
encoded = gName.getEncoded();
// manually derived data:
_encoded = new byte[] {
(byte) 0xa5, (byte) 0x1d, (byte) 0x80, (byte) 0x0e,
(byte) 0x13, (byte) 0x0c, (byte) 0x6e, (byte) 0x61,
(byte) 0x6d, (byte) 0x65, (byte) 0x41, (byte) 0x73,
(byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e,
(byte) 0x65, (byte) 0x72, (byte) 0x81, (byte) 0x0b,
(byte) 0x13, (byte) 0x09, (byte) 0x70, (byte) 0x61,
(byte) 0x72, (byte) 0x74, (byte) 0x79, (byte) 0x4e,
(byte) 0x61, (byte) 0x6d, (byte) 0x65
};
if (!Arrays.equals(encoded, _encoded)) {
System.out.println("Got encoded form of GeneralName is:");
printAsHex(16, "", " ", encoded);
System.out.println("But should be like this:");
printAsHex(16, "", " ", _encoded);
System.out.println("");
pass = false;
}
GeneralNames gNames = new GeneralNames();
gNames.addName(gName);
encoded = gNames.getEncoded();
// manually derived data:
_encoded = new byte[] {
(byte) 0x30, (byte) 0x1f, (byte) 0xa5, (byte) 0x1d,
(byte) 0x80, (byte) 0x0e, (byte) 0x13, (byte) 0x0c,
(byte) 0x6e, (byte) 0x61, (byte) 0x6d, (byte) 0x65,
(byte) 0x41, (byte) 0x73, (byte) 0x73, (byte) 0x69,
(byte) 0x67, (byte) 0x6e, (byte) 0x65, (byte) 0x72,
(byte) 0x81, (byte) 0x0b, (byte) 0x13, (byte) 0x09,
(byte) 0x70, (byte) 0x61, (byte) 0x72, (byte) 0x74,
(byte) 0x79, (byte) 0x4e, (byte) 0x61, (byte) 0x6d,
(byte) 0x65
};
if (!Arrays.equals(encoded, _encoded)) {
System.out.println("Got encoded form of GeneralNames is:");
printAsHex(16, "", " ", encoded);
System.out.println("But should be like this:");
printAsHex(16, "", " ", _encoded);
System.out.println("");
pass = false;
}
assertTrue("Some problems occured.", pass);
}
示例13: testSetSubjectAlternativeNames
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* setSubjectAlternativeNames(Collection<List<?>> names) method testing.
*/
public void testSetSubjectAlternativeNames() {
try {
GeneralName san0 =
new GeneralName(new OtherName("1.2.3.4.5",
new byte[] {1, 2, 0, 1}));
GeneralName san1 = new GeneralName(1, "[email protected]");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralName san3 = new GeneralName(new ORAddress());
GeneralName san4 = new GeneralName(new Name("O=Organization"));
GeneralName san5 =
new GeneralName(new EDIPartyName("assigner", "party"));
GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
GeneralName san7 = new GeneralName(7, "1.1.1.1");
GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");
GeneralNames sans_1 = new GeneralNames();
sans_1.addName(san0);
sans_1.addName(san1);
sans_1.addName(san2);
sans_1.addName(san3);
sans_1.addName(san4);
sans_1.addName(san5);
sans_1.addName(san6);
sans_1.addName(san7);
sans_1.addName(san8);
GeneralNames sans_2 = new GeneralNames();
sans_2.addName(san0);
TestCert cert_1 = new TestCert(sans_1);
TestCert cert_2 = new TestCert(sans_2);
X509CertSelector selector = new X509CertSelector();
selector.setMatchAllSubjectAltNames(true);
selector.setSubjectAlternativeNames(null);
assertTrue("Any certificate should match in the case of null "
+ "subjectAlternativeNames criteria.",
selector.match(cert_1) && selector.match(cert_2));
Collection sans = sans_1.getPairsList();
selector.setSubjectAlternativeNames(sans);
assertTrue("The certificate should match the selection criteria.",
selector.match(cert_1));
assertFalse("The certificate should not match "
+ "the selection criteria.", selector.match(cert_2));
sans.clear();
assertTrue("The modification of initialization object "
+ "should not affect the modification "
+ "of internal object.", selector.match(cert_1));
selector.setSubjectAlternativeNames(sans_2.getPairsList());
assertTrue("The certificate should match the selection criteria.",
selector.match(cert_2));
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
}
示例14: _testEDIPartyName1
import org.apache.harmony.security.x509.GeneralNames; //导入方法依赖的package包/类
/**
* EDIPartyName(String nameAssigner, String partyName) method testing.
*/
public void _testEDIPartyName1() {
boolean pass = true;
try {
EDIPartyName ediPN = new EDIPartyName("nameAssigner", "partyName");
byte[] encoded = ediPN.getEncoded();
// manually derived data:
byte[] _encoded = {
(byte) 0x30, (byte) 0x1d, (byte) 0x80, (byte) 0x0e,
(byte) 0x13, (byte) 0x0c, (byte) 0x6e, (byte) 0x61,
(byte) 0x6d, (byte) 0x65, (byte) 0x41, (byte) 0x73,
(byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e,
(byte) 0x65, (byte) 0x72, (byte) 0x81, (byte) 0x0b,
(byte) 0x13, (byte) 0x09, (byte) 0x70, (byte) 0x61,
(byte) 0x72, (byte) 0x74, (byte) 0x79, (byte) 0x4e,
(byte) 0x61, (byte) 0x6d, (byte) 0x65
};
if (!Arrays.equals(encoded, _encoded)) {
System.out.println("Got encoded form of EDIPartyName is:");
printAsHex(16, "", " ", encoded);
System.out.println("But should be like this:");
printAsHex(16, "", " ", _encoded);
System.out.println("");
pass = false;
}
GeneralName gName = new GeneralName(ediPN);
encoded = gName.getEncoded();
// manually derived data:
_encoded = new byte[] {
(byte) 0xa5, (byte) 0x1d, (byte) 0x80, (byte) 0x0e,
(byte) 0x13, (byte) 0x0c, (byte) 0x6e, (byte) 0x61,
(byte) 0x6d, (byte) 0x65, (byte) 0x41, (byte) 0x73,
(byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e,
(byte) 0x65, (byte) 0x72, (byte) 0x81, (byte) 0x0b,
(byte) 0x13, (byte) 0x09, (byte) 0x70, (byte) 0x61,
(byte) 0x72, (byte) 0x74, (byte) 0x79, (byte) 0x4e,
(byte) 0x61, (byte) 0x6d, (byte) 0x65
};
if (!Arrays.equals(encoded, _encoded)) {
System.out.println("Got encoded form of GeneralName is:");
printAsHex(16, "", " ", encoded);
System.out.println("But should be like this:");
printAsHex(16, "", " ", _encoded);
System.out.println("");
pass = false;
}
GeneralNames gNames = new GeneralNames();
gNames.addName(gName);
encoded = gNames.getEncoded();
// manually derived data:
_encoded = new byte[] {
(byte) 0x30, (byte) 0x1f, (byte) 0xa5, (byte) 0x1d,
(byte) 0x80, (byte) 0x0e, (byte) 0x13, (byte) 0x0c,
(byte) 0x6e, (byte) 0x61, (byte) 0x6d, (byte) 0x65,
(byte) 0x41, (byte) 0x73, (byte) 0x73, (byte) 0x69,
(byte) 0x67, (byte) 0x6e, (byte) 0x65, (byte) 0x72,
(byte) 0x81, (byte) 0x0b, (byte) 0x13, (byte) 0x09,
(byte) 0x70, (byte) 0x61, (byte) 0x72, (byte) 0x74,
(byte) 0x79, (byte) 0x4e, (byte) 0x61, (byte) 0x6d,
(byte) 0x65
};
if (!Arrays.equals(encoded, _encoded)) {
System.out.println("Got encoded form of GeneralNames is:");
printAsHex(16, "", " ", encoded);
System.out.println("But should be like this:");
printAsHex(16, "", " ", _encoded);
System.out.println("");
pass = false;
}
} catch (Exception e) {
e.printStackTrace();
fail("Unexpected Exception was thrown.");
}
assertTrue("Some problems occured.", pass);
}