This commit is contained in:
nicolson%netscape.com 2001-08-03 07:21:09 +00:00
Родитель e13d9d68f5
Коммит 1cbc65ca2e
7 изменённых файлов: 22 добавлений и 19 удалений

Просмотреть файл

@ -44,8 +44,6 @@ public class DigestTest {
try {
Debug.setLevel(Debug.OBNOXIOUS);
if( argv.length != 2 ) {
System.out.println("Usage: DigestTest <dbdir> <infile>");
System.exit(0);
@ -60,6 +58,8 @@ public class DigestTest {
CryptoManager.initialize(dbdir);
Debug.setLevel(Debug.OBNOXIOUS);
/////////////////////////////////////////////////////////////
// Install SUN provider
java.security.Security.addProvider(new sun.security.provider.Sun() );
@ -68,7 +68,7 @@ public class DigestTest {
// Test SHA-1
/////////////////////////////////////////////////////////////
java.security.MessageDigest nsdigest =
java.security.MessageDigest.getInstance("SHA-1", "Netscape");
java.security.MessageDigest.getInstance("SHA-1", "Mozilla-JSS");
java.security.MessageDigest sundigest =
java.security.MessageDigest.getInstance("SHA-1", "SUN");
@ -76,25 +76,25 @@ public class DigestTest {
sundigestOut = sundigest.digest(toBeDigested);
if( MessageDigest.isEqual(nsdigestOut, sundigestOut) ) {
System.out.println("Sun and Netscape give same SHA-1 hash");
System.out.println("Sun and Mozilla give same SHA-1 hash");
} else {
System.out.println("ERROR: Sun and Netscape give different"+
System.out.println("ERROR: Sun and Mozilla give different"+
" SHA-1 hashes");
}
/////////////////////////////////////////////////////////////
// Test MD5
/////////////////////////////////////////////////////////////
nsdigest = java.security.MessageDigest.getInstance("MD5", "Netscape");
nsdigest = java.security.MessageDigest.getInstance("MD5", "Mozilla-JSS");
sundigest = java.security.MessageDigest.getInstance("MD5", "SUN");
nsdigestOut = nsdigest.digest(toBeDigested);
sundigestOut = sundigest.digest(toBeDigested);
if( MessageDigest.isEqual(nsdigestOut, sundigestOut) ) {
System.out.println("Sun and Netscape give same MD5 hash");
System.out.println("Sun and Mozilla give same MD5 hash");
} else {
System.out.println("ERROR: Sun and Netscape give different"+
System.out.println("ERROR: Sun and Mozilla give different"+
" MD5 hashes");
}

Просмотреть файл

@ -56,8 +56,6 @@ public class JCASigTest {
KeyPairGenerator kpgen;
KeyPair keyPair;
Debug.setLevel(Debug.OBNOXIOUS);
if(args.length != 2) {
usage();
return;
@ -71,6 +69,8 @@ public class JCASigTest {
CryptoManager.initialize(vals);
manager = CryptoManager.getInstance();
Debug.setLevel(Debug.OBNOXIOUS);
token = manager.getTokenByName(tokenname);
Provider[] providers = Security.getProviders();

Просмотреть файл

@ -46,7 +46,7 @@ public class KeyWrapping {
try {
CryptoManager.initialize("dbdir");
CryptoManager.initialize(".");
CryptoManager cm = CryptoManager.getInstance();
CryptoToken token = cm.getInternalCryptoToken();
CryptoToken keyToken = cm.getInternalKeyStorageToken();

Просмотреть файл

@ -53,8 +53,6 @@ public class SelfTest {
char[] passchar1 = {'f', 'o', 'o', 'b', 'a', 'r'};
char[] passchar2 = {'n', 'e', 't', 's', 'c', 'a', 'p', 'e'};
Debug.setLevel(Debug.OBNOXIOUS);
if(args.length != 1) {
System.err.println("Usage: java ...SelfTest <dbdir>");
return;
@ -69,6 +67,7 @@ public class SelfTest {
System.out.println("CryptoManager not initialized");
return;
}
Debug.setLevel(Debug.OBNOXIOUS);
try {
tok = manager.getTokenByName("asdffda");

Просмотреть файл

@ -64,7 +64,7 @@ public class SymKeyGen {
}
keyData = key.getKeyData();
if( keyData.length != 8 ) {
throw new Exception("key data wrong length");
throw new Exception("key data wrong length: " + keyData.length);
}
System.out.println("DES key is correct");
@ -104,7 +104,7 @@ public class SymKeyGen {
}
keyData = key.getKeyData();
if( keyData.length != 24 ) {
throw new Exception("key data wrong length");
throw new Exception("key data wrong length: " + keyData.length);
}
System.out.println("DES3 key is correct");
@ -123,7 +123,7 @@ public class SymKeyGen {
}
keyData = key.getKeyData();
if( keyData.length != 16 ) {
throw new Exception("key data wrong length");
throw new Exception("key data wrong length: " + keyData.length);
}
System.out.println("RC4 key is correct");
@ -150,7 +150,7 @@ public class SymKeyGen {
}
keyData = key.getKeyData();
if( keyData.length != 8 ) {
throw new Exception("key data wrong length");
throw new Exception("key data wrong length: " + keyData.length);
}
System.out.println("PBE key is correct");

Просмотреть файл

@ -48,6 +48,7 @@ PRIVATE_CLASSES = \
CloseDBs \
KeyWrapping \
ListCerts \
socketTest \
$(NULL)
JSRCS = \
@ -59,4 +60,5 @@ JSRCS = \
CloseDBs.java \
KeyWrapping.java \
ListCerts.java \
socketTest.java \
$(NULL)

Просмотреть файл

@ -41,10 +41,12 @@ public class socketTest {
// initialize CryptoManager.
CryptoManager.initialize(".");
//SSLSocket.setCipherPolicy(SSLSocket.CipherPolicy.DOMESTIC);
SSLSocket sslSocket = new SSLSocket("www.verisign.com", 443);
SSLSocket sslSocket = new SSLSocket("www.amazon.com", 443);
sslSocket.forceHandshake();
System.out.println("Test");
System.out.println("Test, forced handshake");
} catch( Exception e ) {
e.printStackTrace();
}