diff options
author | Peter <peter@cryptic.(none)> | 2013-06-21 11:30:03 +0400 |
---|---|---|
committer | Peter <peter@cryptic.(none)> | 2013-06-21 11:30:03 +0400 |
commit | f3a4aa206e47a47a394b80c87d133cd4bf34ad13 (patch) | |
tree | cb8896862293c1c593382bbd356bf7aa3d5efac7 /core/src/main/java/org/bouncycastle/crypto/tls/DigitallySigned.java | |
parent | 9884183732cbf26fc7565e12a5be789129ed6849 (diff) |
Fix line endings
Diffstat (limited to 'core/src/main/java/org/bouncycastle/crypto/tls/DigitallySigned.java')
-rw-r--r-- | core/src/main/java/org/bouncycastle/crypto/tls/DigitallySigned.java | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/tls/DigitallySigned.java b/core/src/main/java/org/bouncycastle/crypto/tls/DigitallySigned.java index 02fdf032..45ae658f 100644 --- a/core/src/main/java/org/bouncycastle/crypto/tls/DigitallySigned.java +++ b/core/src/main/java/org/bouncycastle/crypto/tls/DigitallySigned.java @@ -1,70 +1,70 @@ -package org.bouncycastle.crypto.tls;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class DigitallySigned
-{
- protected SignatureAndHashAlgorithm algorithm;
- protected byte[] signature;
-
- public DigitallySigned(SignatureAndHashAlgorithm algorithm, byte[] signature)
- {
- if (signature == null)
- {
- throw new IllegalArgumentException("'signature' cannot be null");
- }
-
- this.algorithm = algorithm;
- this.signature = signature;
- }
-
- /**
- * @return a {@link SignatureAndHashAlgorithm} (or null before TLS 1.2).
- */
- public SignatureAndHashAlgorithm getAlgorithm()
- {
- return algorithm;
- }
-
- public byte[] getSignature()
- {
- return signature;
- }
-
- /**
- * Encode this {@link DigitallySigned} to an {@link OutputStream}.
- *
- * @param output
- * the {@link OutputStream} to encode to.
- * @throws IOException
- */
- public void encode(OutputStream output) throws IOException
- {
- if (algorithm != null)
- {
- algorithm.encode(output);
- }
- TlsUtils.writeOpaque16(signature, output);
- }
-
- /**
- * Parse a {@link DigitallySigned} from an {@link InputStream}.
- *
- * @param input
- * the {@link InputStream} to parse from.
- * @return a {@link DigitallySigned} object.
- * @throws IOException
- */
- public static DigitallySigned parse(TlsContext context, InputStream input) throws IOException
- {
- SignatureAndHashAlgorithm algorithm = null;
- if (TlsUtils.isTLSv12(context))
- {
- algorithm = SignatureAndHashAlgorithm.parse(input);
- }
- byte[] signature = TlsUtils.readOpaque16(input);
- return new DigitallySigned(algorithm, signature);
- }
-}
+package org.bouncycastle.crypto.tls; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public class DigitallySigned +{ + protected SignatureAndHashAlgorithm algorithm; + protected byte[] signature; + + public DigitallySigned(SignatureAndHashAlgorithm algorithm, byte[] signature) + { + if (signature == null) + { + throw new IllegalArgumentException("'signature' cannot be null"); + } + + this.algorithm = algorithm; + this.signature = signature; + } + + /** + * @return a {@link SignatureAndHashAlgorithm} (or null before TLS 1.2). + */ + public SignatureAndHashAlgorithm getAlgorithm() + { + return algorithm; + } + + public byte[] getSignature() + { + return signature; + } + + /** + * Encode this {@link DigitallySigned} to an {@link OutputStream}. + * + * @param output + * the {@link OutputStream} to encode to. + * @throws IOException + */ + public void encode(OutputStream output) throws IOException + { + if (algorithm != null) + { + algorithm.encode(output); + } + TlsUtils.writeOpaque16(signature, output); + } + + /** + * Parse a {@link DigitallySigned} from an {@link InputStream}. + * + * @param input + * the {@link InputStream} to parse from. + * @return a {@link DigitallySigned} object. + * @throws IOException + */ + public static DigitallySigned parse(TlsContext context, InputStream input) throws IOException + { + SignatureAndHashAlgorithm algorithm = null; + if (TlsUtils.isTLSv12(context)) + { + algorithm = SignatureAndHashAlgorithm.parse(input); + } + byte[] signature = TlsUtils.readOpaque16(input); + return new DigitallySigned(algorithm, signature); + } +} |