Skip to content

Commit

Permalink
changes for deploying to OSSRH
Browse files Browse the repository at this point in the history
  • Loading branch information
qwefgh90 committed May 11, 2023
1 parent 3ddacb6 commit 6a4919a
Show file tree
Hide file tree
Showing 4 changed files with 1,808 additions and 1,898 deletions.
70 changes: 69 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.qwefgh90</groupId>
<artifactId>krypto</artifactId>
<version>0.1</version>
<version>0.1-SNAPSHOT</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand All @@ -21,4 +21,72 @@
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<excludePackageNames>krypto.algorithm.aria.impl.*:krypto.algorithm.lea.impl.*:krypto.algorithm.seed.impl.*</excludePackageNames>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</project>
27 changes: 23 additions & 4 deletions src/main/java/krypto/Algorithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@

public abstract class Algorithm {

/**
* The algorithm kind of this instance
*/
protected final Kind kind;

/**
* The seed value for creating a secret key
*/
protected final String masterKey;

/**
* A byte array of the masterKey
*/
protected final byte[] keyBytes;

/**
* The length of the key for encryption and descryption
*/
protected final int keyLength;

public Algorithm(Kind kind, String masterKey, byte[] keyBytes, int keyLength) {
Expand All @@ -20,17 +34,22 @@ public Kind getKind() {
}

/**
* @param bytes any plain text
* @return
* Encrypt a plain text.
* @param bytes Any plain text
* @return A cipher text
*/
public abstract byte[] encrypt(byte[] bytes);

/**
* @param bytes any cipher text which is encrypted with supported algorithms
* @return
* Decrypt a cipher text.
* @param bytes Any cipher text which is encrypted with supported algorithms
* @return A decrypted text
*/
public abstract byte[] decrypt(byte[] bytes);

/**
* This enum refers to a list of algorithms which implementation is provided.
*/
public enum Kind {
ARIA,
SEED,
Expand Down
Loading

0 comments on commit 6a4919a

Please sign in to comment.