Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pg/src/main/java/org/bouncycastle/openpgp/operator/PGPPad.java')
-rw-r--r--pg/src/main/java/org/bouncycastle/openpgp/operator/PGPPad.java50
1 files changed, 0 insertions, 50 deletions
diff --git a/pg/src/main/java/org/bouncycastle/openpgp/operator/PGPPad.java b/pg/src/main/java/org/bouncycastle/openpgp/operator/PGPPad.java
deleted file mode 100644
index c9cebe7d..00000000
--- a/pg/src/main/java/org/bouncycastle/openpgp/operator/PGPPad.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.bouncycastle.openpgp.operator;
-
-import org.bouncycastle.openpgp.PGPException;
-
-/**
- * Utility class that provides padding addition and removal for PGP session keys.
- */
-public class PGPPad
-{
- private PGPPad()
- {
-
- }
-
- public static byte[] padSessionData(byte[] sessionInfo)
- {
- byte[] result = new byte[40];
-
- System.arraycopy(sessionInfo, 0, result, 0, sessionInfo.length);
-
- byte padValue = (byte)(result.length - sessionInfo.length);
-
- for (int i = sessionInfo.length; i != result.length; i++)
- {
- result[i] = padValue;
- }
-
- return result;
- }
-
- public static byte[] unpadSessionData(byte[] encoded)
- throws PGPException
- {
- byte padValue = encoded[encoded.length - 1];
-
- for (int i = encoded.length - padValue; i != encoded.length; i++)
- {
- if (encoded[i] != padValue)
- {
- throw new PGPException("bad padding found in session data");
- }
- }
-
- byte[] taggedKey = new byte[encoded.length - padValue];
-
- System.arraycopy(encoded, 0, taggedKey, 0, taggedKey.length);
-
- return taggedKey;
- }
-}