Ejemplo n.º 1
0
 public final void testReadResolve05() throws Exception {
   for (String algorithm : keyFactoryAlgorithms) {
     KeyRepChild kr =
         new KeyRepChild(KeyRep.Type.PRIVATE, algorithm, "PKCS#8", new byte[] {1, 2, 3});
     try {
       kr.readResolve();
       fail("NotSerializableException has not been thrown (no format) " + algorithm);
     } catch (NotSerializableException expected) {
     }
   }
 }
Ejemplo n.º 2
0
  public final void testReadResolve02() throws Exception {
    KeyRepChild kr = new KeyRepChild(KeyRep.Type.PUBLIC, "", "", new byte[] {});
    try {
      kr.readResolve();
      fail("NotSerializableException has not been thrown (no format)");
    } catch (NotSerializableException expected) {
    }

    kr = new KeyRepChild(KeyRep.Type.PUBLIC, "", "RAW", new byte[] {});
    try {
      kr.readResolve();
      fail("NotSerializableException has not been thrown (unacceptable format)");
    } catch (NotSerializableException expected) {
    }

    kr = new KeyRepChild(KeyRep.Type.PUBLIC, "bla-bla", "X.509", new byte[] {});
    try {
      kr.readResolve();
      fail("NotSerializableException has not been thrown (unknown KeyFactory algorithm)");
    } catch (NotSerializableException expected) {
    }
  }
Ejemplo n.º 3
0
  public final void testReadResolve01() throws Exception {
    KeyRepChild kr = new KeyRepChild(KeyRep.Type.SECRET, "", "", new byte[] {});
    try {
      kr.readResolve();
      fail("NotSerializableException has not been thrown (no format)");
    } catch (NotSerializableException expected) {
    }

    kr = new KeyRepChild(KeyRep.Type.SECRET, "", "X.509", new byte[] {});
    try {
      kr.readResolve();
      fail("NotSerializableException has not been thrown (unacceptable format)");
    } catch (NotSerializableException expected) {
    }

    kr = new KeyRepChild(KeyRep.Type.SECRET, "", "RAW", new byte[] {});
    try {
      kr.readResolve();
      fail("NotSerializableException has not been thrown (empty key)");
    } catch (NotSerializableException expected) {
    }
  }