Package de.elo.ix.client.system
Interface EncryptLicense
public interface EncryptLicense
Encrypt and decrypt license text.
The license text is encrypted by AES using an internally generated random key. The AES key is
encrypted by RSA and is added to the encrypted license text. The encrypted license text looks
like:
ELO DIGITAL OFFICE GMBH ENCRYPTED LICENSE --- fix header followed by some comment lines createDate=2021-07-02 expirationDate=2022-07-31 product=20e customer=ELO 20 Test Not for resale hash=506e679fa27fc701693986869c4592e6195a3d17115c2ee559685c0fe5c64a15 SqZVF2SPZfX9LX0sjo9Po4CkD4r3gjNDw5ItpDIyK4dU6Dsf3FEcUPHGbuOznjLXUZscn8iunj3W+tQOVqcSlBhjcgNWUqECCceB 7KR+cK22IgQDbtEdaVjmIoqxbCjPDdOjOzpR56eN6emaxxRCp4Hi+N85XO2UYrw/5ZaiyVcyzOuVM7vWcGH0e0yf5y98j3uYDant dOo3ZcJHsknpjr6o5lTHaUWilMCBiH6/1FW/YkAZQxsKQ6aigVwsoPMvvmZM98FnBhP4zfJSDfh/YahappwS+W2S4tRtqpK1g5+f lzBmufY6X81mTFP8GfTQPZLK++MtCnDDqt17HFz7+g== --- encrypted AES key Nw/r4OFzm7j6bFwqUiyaTnHYd5qT0ZVnY8CzxzGylecavjxSfZG5FzZNMputLsfplANeAf1KxbRRwsqQnFfr6b/S1juBcb63tiKT MnsxFtVtJ76FbFA6WLvsI49OR0kNDEJlBSCcXu5yKvMuKymbq7Jg7XTqkWcEfDkKHwMyE6/tGbmmpEkGXOV4QdrLdNy4oROA8vTF ebjJJsdvKlYEY18dWOrT0whyRpL/Uzh/KqLlKRDEaiOZNFiTupNNo95nOCq7vrCzsu296Ylz7Wsys/X6mVAV51K9tRrZahjMcOES D6sthVzJYzTlqeIJ4ONrQG7yYFXHWTy3wdqOVrbIsISzmh7//kepvq+X+RbHB/Tl2ZWXOacSL5+5t5bwTxNQ4ILJf9/OE9yf2ilO xqYXFPYkJisuJynyjdBXlmVaVja9euyegKk/WqhY21CJnAPy+qnU6oC7eV1lRgO58FsJz/sL1qXhTtfrxfa+3WDzF3riTs5QjPDL GHGicIVuZnlz --- encrypted license content 2+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAos+/v9EzdvvE42YZL1H65+0uwDPW5l1RI2n0hZqvkZwkzpq2lctujl LtwaXeSgvL66SbYJuxIy7S4ZA/aTP4UVEtqVPKYNatgiE+N6lBw/CVu94MWpW99eDmuLU9uM7gN+mJDdDz2tHyrW6Z3KeHn1cMOA 87pJgG9tSQaIRN7KQjd+wZUMUbUhk18vnO/tVUZQTa24nklF3ItMTjjFnAXKQnnemP9xqm3ekKnwcjOiQmGRWn6j01jwU9PcajnD QuQdJx8WQaggQl7OJcGHeFl46x8rHG0or7i81dHuXhHzXk4qAze7Kg7j90ki2d1CmQc7xzqtVOQUghFr9adlsrlQIDAQAB --- public license keyFor decryption, the entire text has to be passed along with the private RSA key. Function
generateKeysRSA()
can be used to create a RSA key pair. To encrypt a license,
call encrypt(PublicKey, String)
. To decrypt an encrypted license call
decrypt(PrivateKey, String)
.
EIX-2598-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Properties of the encrypted license. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
License creation date.static final int
Current version.static final String
License expiration date.static final String
Address of the license server.static final String
Address of the old license server.static final String
URL for downloading licenses.static final String
Old URL for downloading licenses.static final String
Product name.static final String
Reference to license repository.static final String
Encrypted license version.static final int
Use RSA with padding.static final int
Include public key in encrypted license text. -
Method Summary
Modifier and TypeMethodDescriptiondecrypt
(PrivateKey privateKey, String encryptedText) Decrypt license data.Encrypt license text.Generate RSA key pair.static EncryptLicense
Get instance to access the functions.getPublicKey
(PrivateKey privateKey) Extract a public key from a given private key.getRemoteLicenseAddress
(String serverAddress, PublicKey publicKey) Get license remote URL.boolean
isLicenseEncryptionKey
(String licenseText) Return true, if the given text is an encryption key.keyToString
(PrivateKey privateKey) Serialize a private RSA key to string.keyToString
(PublicKey publicKey) Serialize a public RSA key to string.Get properties from encrypted license.Decode the string representation of a private RSA key.Decode the string representation of a public RSA key.sign
(PrivateKey privateKey, String data) Compute signature of given data.boolean
Verify signature.
-
Field Details
-
VERSION_WITH_PUBLIC_KEY
static final int VERSION_WITH_PUBLIC_KEYInclude public key in encrypted license text. EIX-3641- See Also:
-
VERSION_RSA_WITH_PADDING
static final int VERSION_RSA_WITH_PADDINGUse RSA with padding. EIX-2781- See Also:
-
CURRENT_VERSION
static final int CURRENT_VERSIONCurrent version.- See Also:
-
VERSION
Encrypted license version. EIX-3641- See Also:
-
SORDGUID
Reference to license repository. EIX-3641- See Also:
-
PRODUCT
Product name. EIX-3641- See Also:
-
EXPIRATION_DATE
License expiration date. EIX-3641- See Also:
-
CREATE_DATE
License creation date. EIX-3641- See Also:
-
LICENSE_SERVER_ADDRESS
Address of the license server. Used as primary server address since 23.00.001. EIX-3641- See Also:
-
LICENSE_SERVER_ADDRESS_FALLBACK
Address of the old license server. Used as primary server address for versions up to 23.00.000.- See Also:
-
LICENSE_SERVER_URL
URL for downloading licenses. EIX-3632: Preferred URL for connecting to the license server (since 23.00.001). If the license is not available at this address, the license is downloaded fromLICENSE_SERVER_URL_FALLBACK
.- See Also:
-
LICENSE_SERVER_URL_FALLBACK
Old URL for downloading licenses. EIX-3632: Fallback URL for connecting to the license server. Versions up to 23.00.000 call only this URL.- See Also:
-
-
Method Details
-
getInstance
Get instance to access the functions.- Returns:
- Instance
-
encrypt
Encrypt license text.- Parameters:
publicKey
- Public RSA keylicenseText
- License file content- Returns:
- Encrypted license data
-
decrypt
Decrypt license data.- Parameters:
privateKey
- Private RSA keyencryptedText
- Encrypted license data- Returns:
- License file content
-
parse
Get properties from encrypted license. EIX-3641 SeeVERSION
and others.- Parameters:
encryptedText
- Encrypted license text- Returns:
- Properties
-
keyToString
Serialize a public RSA key to string.- Parameters:
publicKey
- Public RSA key- Returns:
- String
-
keyToString
Serialize a private RSA key to string.- Parameters:
privateKey
- Private RSA key- Returns:
- String
-
publicKeyFromString
Decode the string representation of a public RSA key.- Parameters:
str
- String representation- Returns:
- Key object
-
privateKeyFromString
Decode the string representation of a private RSA key.- Parameters:
str
- String representation- Returns:
- Key object
-
getPublicKey
Extract a public key from a given private key.- Parameters:
privateKey
- Private RSA key- Returns:
- Public RSA key
-
getRemoteLicenseAddress
Get license remote URL. URL from where the encrypted license can be downloaded. The URL contains a hash value that identifies the license. The hash value is built based on the public key. In order to get only the hash value, call this function with an empty serverAddress.- Parameters:
serverAddress
- URL to license server, usuallyLICENSE_SERVER_URL
or empty to get the license ID.publicKey
- Public RSA key or null to get the download path.- Returns:
- URL
-
isLicenseEncryptionKey
Return true, if the given text is an encryption key.- Parameters:
licenseText
- Maybe encrypted key- Returns:
- true, if encryption key
-
generateKeysRSA
KeyPair generateKeysRSA()Generate RSA key pair.- Returns:
- RSA keys
-
sign
Compute signature of given data. EIX-3641- Parameters:
privateKey
- Private keydata
- Data to be signed- Returns:
- Signature
-
verify
Verify signature. EIX-3641- Parameters:
publicKey
- Public keydata
- Datasignature
- Signature of data- Returns:
- true, if signature is valid
-