Package javax0.license3j.io
Class KeyPairReader
- java.lang.Object
-
- javax0.license3j.io.KeyPairReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class KeyPairReader extends java.lang.Object implements java.io.Closeable
Class to read a key from file. This class can be used in the application to load the public key and it is also used in the repl application. Create an instance of this class using one of the constructors specifying the source of the license key and then use one of theread...()
methods to read the key into aLicenseKeyPair
object.
-
-
Constructor Summary
Constructors Constructor Description KeyPairReader(java.io.File file)
KeyPairReader(java.io.InputStream is)
KeyPairReader(java.lang.String fileName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
LicenseKeyPair
readPrivate()
LicenseKeyPair
readPrivate(IOFormat format)
LicenseKeyPair
readPublic()
LicenseKeyPair
readPublic(IOFormat format)
-
-
-
Constructor Detail
-
KeyPairReader
public KeyPairReader(java.io.InputStream is)
-
KeyPairReader
public KeyPairReader(java.io.File file) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
KeyPairReader
public KeyPairReader(java.lang.String fileName) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
-
Method Detail
-
readPublic
public LicenseKeyPair readPublic() throws java.io.IOException, java.security.spec.InvalidKeySpecException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException
-
readPublic
public LicenseKeyPair readPublic(IOFormat format) throws java.io.IOException, java.security.spec.InvalidKeySpecException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException
-
readPrivate
public LicenseKeyPair readPrivate() throws java.io.IOException, java.security.spec.InvalidKeySpecException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException
-
readPrivate
public LicenseKeyPair readPrivate(IOFormat format) throws java.io.IOException, java.security.spec.InvalidKeySpecException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-