Methods Summary |
---|
public void | kg()
KeyGenerator kg = KeyGenerator.getInstance("DES");
kg.init(new SecureRandom());
SecretKey key = kg.generateKey();
|
public void | kpg()
KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA");
kpg.initialize(1024);
KeyPair pair = kpg.genKeyPair();
|
public static void | main(java.lang.String[] args)
|
public byte[] | makeBytesFromDESKey(javax.crypto.SecretKey key)
SecretKeyFactory desFactory = SecretKeyFactory.getInstance("DES");
DESKeySpec spec =
(DESKeySpec)desFactory.getKeySpec(key, DESKeySpec.class);
return spec.getKey();
|
public javax.crypto.SecretKey | makeDESKey(byte[] input, int offset)
SecretKeyFactory desFactory = SecretKeyFactory.getInstance("DES");
KeySpec spec = new DESKeySpec(input, offset);
return desFactory.generateSecret(spec);
|
public void | printKey(java.security.Identity i)
PublicKey k = i.getPublicKey();
System.out.println(" Public key uses " + k.getAlgorithm() +
" and is encoded with " + k.getFormat() + ".");
|