Use the following command to create a detached ASCII signature:
gpg --armor --output <ASC_FILE> --detach-sig <FILE_TO_SIGN>
Extremely Serious
Use the following command to create a detached ASCII signature:
gpg --armor --output <ASC_FILE> --detach-sig <FILE_TO_SIGN>
Run the following command:
gpg --receive-keys <KEY_ID>
Run the following command:
gpg --fingerprint <KEY_ID>
gpg --verify <ASC_FILE> <SIGNED_FILE>
gpg --full-gen-key
Please select what kind of key you want: (1) RSA and RSA (default) (2) DSA and Elgamal (3) DSA (sign only) (4) RSA (sign only) Your selection?
RSA keys may be between 1024 and 4096 bits long. What keysize do you want? (2048)
Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0)
Key does not expire at all Is this correct? (y/N)
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?
The output will be ending with something like the following:
pub rsa2048 2019-11-27 [SC] 8C99E30527B112D1CB6D646FE86A4FE7189AADC9 uid Real Name <real_email@email.com> sub rsa2048 2019-11-27 [E]
The second line is the PGP key ID. Thus from the output above. The key id is:
8C99E30527B112D1CB6D646FE86A4FE7189AADC9
The my-secret-key.pgp file generated by this command can be use for signing your binaries.
Run the following command:
gpg --export-secret-keys <KEY_ID> > my-secret-key.pgp
DO NOT SHARE THIS FILE OR COMMIT TO YOUR REPOSITORY.
Run the following command:
gpg --keyserver hkp://keys.openpgp.org --send-keys <KEY_ID>
This will only work if you submit your keys using the preceding section.
nexusUsername=<SONATYPE_USERNAME> nexusPassword=<SONATYPE_PASSWORD> signing.keyId=<PGP_PUBLIC_KEY_ID> signing.password=<PGP_PASS_PHRASE> signing.secretKeyRingFile=<PGP_EXPORTED_PRIVATE_KEY>
plugins { id "java" id "com.bmuschko.nexus" version "2.3.1" // Gradle Sonatype Nexus Plugin }
modifyPom { project { name '<PROJECT_NAME>' description '<PROJECT_DESCRIPTION>' url '<PROJECT_WEBSITE>' inceptionYear '<PROJECT_INCEPTION_YEAR>' scm { url '<PROJECT_SCM_ADDRESS>' connection '<PROJECT_SCM_ADDRESS>' developerConnection '<PROJECT_SCM_ADDRESS>' } licenses { license { name '<PROJECT_LICENSE_NAME>' url '<PROJECT_LICENSE_ADDRESS>' distribution 'repo' } } developers { developer { id '<DEVELOPER_ID>' name '<DEVELOPER_NAME>' email '<DEVELOPER_EMAIL>' } } } } extraArchive { sources = true tests = true javadoc = true } nexus { sign = true repositoryUrl = '<SONATYPE_RELEASE_REPOSITORY>' snapshotRepositoryUrl = '<SONATYPE_SNAPSHOT_REPOSITORY>' }
plugins { id 'java' id "com.bmuschko.nexus" version "2.3.1" // Gradle Sonatype Nexux Plugin id "io.codearte.nexus-staging" version "0.21.1" // Gradle Nexus Staging Plugin }
gradlew getStagingProfile
nexusStaging { stagingProfileId = "<STAGING_PROFILE_ID>" }
Run the following command:
gradlew publishToSonatype
Run the following command:
gradlew closeAndReleaseSonatypeStagingRepository
If there are any errors after running the preceding command
Do this error correction process until all the errors were corrected.
After around 10 minutes, navigate to your registered group id from sonatype, starting from the following address:
https://repo.maven.apache.org/maven2/
After around 2 hours, your artifact id may be searchable in maven central from the following address:
To write into a text file in gosu we can use the FileWriter as follows:
using(var writer = new BufferedWriter(new FileWriter("<FILENAME>"))) { writer.write("<TEXT>") // Writes a text to into a file. writer.flush() // Must be at the last. }
Token | Description |
FILENAME | The target filename to write into. |
TEXT | The text to write into the filename. You can write as many text as you like. Just don't forget the flush method at the end. |
To read from a text file in gosu we can use the FileReader with Scanner as follows:
using (var scanner = new Scanner(new BufferedReader(new FileReader("<FILENAME>")))) { while(scanner.hasNext()) { print(scanner.nextLine()) //---Reads a line from the file. } }
Token | Description |
FILENAME | The target filename to read from. |
If the if conditions are becoming longer and complicated. It is possible to separate all the conditions to a list like the following:
var conditions : List<block() : Boolean>= { \-> { print("1") return true }, \-> { print("2") return false } }
The above example is just a simple illustration and not good for actual coding.
The following code snippet is for hunting at least one truth condition using reduce method to do OR logic testing.
if (conditions?.reduce(false, \ ___aggr, ___cond -> ___aggr || ___cond())) { print("I'm in") }
Once a truth condition was identified it stops checking the rest and the if condition is evaluated to true.
The following code snippet is for checking all the conditions are true using the reduce method to do AND logic testing.
if (conditions?.reduce(true, \ ___aggr, ___cond -> ___aggr && ___cond())) { print("I'm in") }
Once a false condition was identified it stops checking the rest and the if condition is evaluated to false.
Protocol | proxyHost | proxyPort | nonProxyHosts | proxyUser | proxyPassword |
http | Y | Y | Y | Y | Y |
https | Y | Y | also use http.nonProxyHosts | Y | Y |
ftp | Y | Y | Y | Y | Y |
For nonProxyHosts, a list of hosts that should be reached directly without the proxy. The list is separated by '|' (i.e. pipe symbol). The patterns may start or end with a '*' for wildcards.
If the protocol value is Y for a particular header, it means you can combine the protocol with the header (e.g. http is Y for proxyHost in the table, thus we can combine it as http.proxyHost) to form a single property.
Property | Description |
socksProxyHost | The host of the SOCKS proxy server. |
socksProxyPort | The port (i.e. defaulting to 1080) where SOCKS proxy server is listening. |
socksProxyVersion | The version (i.e. defaulting to 5) of the SOCKS protocol supported by the server. |
java.net.socks.username | The username for authenticating to SOCKSv5 proxy server. |
java.net.socks.password | The password for authenticating to SOCKSv5 proxy server. |
java.net.useSystemProxies set this property to true to use the system proxy.
java -Dhttp.proxyHost=localhost -Dhttp.proxyPort=808 ApplicationAccessingTheNet
1a.) For TLS, use the following command:
openssl s_client -connect smtp.gmail.com:587 -starttls smtp
1b.) For SSL, use the following command:
openssl s_client -connect smtp.gmail.com:465
2.) Both outputs of the preceding commands are long but you we are just interested in the entries that starts with:
-----BEGIN CERTIFICATE-----
and ends with:
-----END CERTIFICATE-----
3.) Copy that block of entries to a new file like smtp.gmail.com.pem.
This file is now the certificate file.
Use the following command to list the entries of a Java keystore:
The keytool is normally found in $JAVA_HOME/jre/bin (i.e. the $JAVA_HOME variable is where you’ve installed JDK).
keytool -list -v -keystore <KEYSTORE_FILE> -storepass <KEYSTORE_PASSWORD>
Include the -a <ALIAS> parameter to just display a single certificate.
Token | Description |
KEYSTORE_FILE | The target key store file (e.g. cacerts found in $JAVA_HOME/jre/lib/security) |
KEYSTORE_PASSWORD | The password for accessing the keystore (i.e. the default is changeit) |
Use the following command in importing a certificate to Java keystore:
The keytool is normally found in $JAVA_HOME/jre/bin (i.e. the $JAVA_HOME variable is where you've installed JDK).
keytool -importcert -alias <ALIAS> -v -keystore <KEYSTORE_FILE> -file <INPUT_FILE> -storepass <KEYSTORE_PASSWORD>
Token | Description |
ALIAS | Alias name of the entry to process |
KEYSTORE_FILE | The target key store file (e.g. cacerts found in $JAVA_HOME/jre/lib/security) |
INPUT_FILE | Input file name (i.e. certificate file like cer, crt or pem) |
KEYSTORE_PASSWORD | The password for accessing the keystore (i.e. the default is changeit) |
© 2025 Ron and Ella Wiki Page
Theme by Anders Noren — Up ↑
Recent Comments