FileDocCategorySizeDatePackage
Shorts.javaAPI DocExample1400Tue Apr 07 15:56:24 BST 1998None

Shorts

public class Shorts extends Object

Fields Summary
Constructors Summary
Methods Summary
public voidkg()

    KeyGenerator kg = KeyGenerator.getInstance("DES");
    kg.init(new SecureRandom());
    SecretKey key = kg.generateKey();
  
public voidkpg()

    KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA");
    kpg.initialize(1024);
    KeyPair pair = kpg.genKeyPair();
  
public static voidmain(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.SecretKeymakeDESKey(byte[] input, int offset)

    SecretKeyFactory desFactory = SecretKeyFactory.getInstance("DES");
    KeySpec spec = new DESKeySpec(input, offset);
    return desFactory.generateSecret(spec);
  
public voidprintKey(java.security.Identity i)

	  PublicKey k = i.getPublicKey();
	  System.out.println("  Public key uses " + k.getAlgorithm() +
	      " and is encoded with " + k.getFormat() + ".");