diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-10 19:13:38 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-10 19:13:38 +0700 |
commit | c4f02c22b53e19a2445ee13865dc5e0e04c84359 (patch) | |
tree | e623a07c462c95883a661439dfe188a980b52c7d /crypto/src/asn1/DerOutputStream.cs | |
parent | Add more PkiFailureInfo constants (diff) | |
download | BouncyCastle.NET-ed25519-c4f02c22b53e19a2445ee13865dc5e0e04c84359.tar.xz |
Add BerBitString and improve "unused bit" handling
Diffstat (limited to 'crypto/src/asn1/DerOutputStream.cs')
-rw-r--r-- | crypto/src/asn1/DerOutputStream.cs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/crypto/src/asn1/DerOutputStream.cs b/crypto/src/asn1/DerOutputStream.cs index c03d9dc11..69d5d5f28 100644 --- a/crypto/src/asn1/DerOutputStream.cs +++ b/crypto/src/asn1/DerOutputStream.cs @@ -19,7 +19,7 @@ namespace Org.BouncyCastle.Asn1 if (length > 127) { int size = 1; - uint val = (uint) length; + uint val = (uint)length; while ((val >>= 8) != 0) { @@ -43,18 +43,29 @@ namespace Org.BouncyCastle.Asn1 int tag, byte[] bytes) { - WriteByte((byte) tag); + WriteByte((byte)tag); WriteLength(bytes.Length); Write(bytes, 0, bytes.Length); } - internal void WriteEncoded( + internal void WriteEncoded( + int tag, + byte first, + byte[] bytes) + { + WriteByte((byte)tag); + WriteLength(bytes.Length + 1); + WriteByte(first); + Write(bytes, 0, bytes.Length); + } + + internal void WriteEncoded( int tag, byte[] bytes, int offset, int length) { - WriteByte((byte) tag); + WriteByte((byte)tag); WriteLength(length); Write(bytes, offset, length); } |