java.lang.Object
com.traxel.crypto.DHUtil
- public class DHUtil
- extends java.lang.Object
This class has been coded to solve my specific problems.
It is not general purpose. Use at your own risk.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DH
public static final java.lang.String DH
- See Also:
- Constant Field Values
DHUtil
public DHUtil()
generateDhParams
public static javax.crypto.spec.DHParameterSpec generateDhParams(int bitSize)
privKeyFromBase16
public static javax.crypto.interfaces.DHPrivateKey privKeyFromBase16(java.io.InputStream in)
throws java.security.spec.InvalidKeySpecException,
java.io.IOException
- WARNING: This is quite happy to extract the base 16 bytes
from a non-base 16 document. EG: if you read from "document"
it would return "dce".
NOTE: This method depends on the termination of the
input stream (IE: it returns -1 in response to a read() ).
pubKeyFromBase16
public static javax.crypto.interfaces.DHPublicKey pubKeyFromBase16(java.io.InputStream in)
throws java.security.spec.InvalidKeySpecException,
java.io.IOException
- WARNING: This is quite happy to extract the base 16 bytes
from a non-base 16 document. EG: if you read from "document"
it would return "dce".
NOTE: This method depends on the termination of the
input stream (IE: it returns -1 in response to a read() ).
pubKeyFromX509
public static javax.crypto.interfaces.DHPublicKey pubKeyFromX509(java.security.spec.X509EncodedKeySpec x509)
throws java.security.spec.InvalidKeySpecException
privKeyFromPkcs8
public static javax.crypto.interfaces.DHPrivateKey privKeyFromPkcs8(java.security.spec.PKCS8EncodedKeySpec pkcs8)
throws java.security.spec.InvalidKeySpecException
pkcs8FromBase16
public static java.security.spec.PKCS8EncodedKeySpec pkcs8FromBase16(java.io.InputStream in)
throws java.io.IOException
x509FromBase16
public static java.security.spec.X509EncodedKeySpec x509FromBase16(java.io.InputStream in)
throws java.io.IOException
readBase16
public static java.lang.String readBase16(java.io.InputStream in)
throws java.io.IOException
isBase16
public static boolean isBase16(char character)
main
public static void main(java.lang.String[] args)