diff options
author | Carlos Perez <carlos_perez@darkoperator.com> | 2014-06-08 19:48:06 -0400 |
---|---|---|
committer | Carlos Perez <carlos_perez@darkoperator.com> | 2014-06-08 19:48:06 -0400 |
commit | d003833c807b7d2f3951e4a4fb3ebc3a466418ed (patch) | |
tree | 42b6eee5801e38674d0b66eef21843a35507df6b /crypto/src/bcpg | |
parent | Check the low-bit of y is consistent with the header byte in hybrid EC point ... (diff) | |
download | BouncyCastle.NET-ed25519-d003833c807b7d2f3951e4a4fb3ebc3a466418ed.tar.xz |
Add support to specifying Hash Algo when adding a subkey and generating a keyring.
DSA2 and in the future EC keys requiere hashing higher than SHA1.
Diffstat (limited to 'crypto/src/bcpg')
-rw-r--r-- | crypto/src/bcpg/ArmoredOutputStream.cs | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/crypto/src/bcpg/ArmoredOutputStream.cs b/crypto/src/bcpg/ArmoredOutputStream.cs index b3a32c6f5..02d3f72a0 100644 --- a/crypto/src/bcpg/ArmoredOutputStream.cs +++ b/crypto/src/bcpg/ArmoredOutputStream.cs @@ -313,18 +313,57 @@ namespace Org.BouncyCastle.Bcpg } } - private void WriteHeaderEntry( - string name, - string v) + protected override void Dispose(bool disposing) + { + try + { + if (type != null) + { + if (bufPtr > 0) + { + Encode(outStream, buf, bufPtr); + } + + DoWrite(nl + '='); + + int crcV = crc.Value; + + buf[0] = ((crcV >> 16) & 0xff); + buf[1] = ((crcV >> 8) & 0xff); + buf[2] = (crcV & 0xff); + + Encode(outStream, buf, 3); + + DoWrite(nl); + DoWrite(footerStart); + DoWrite(type); + DoWrite(footerTail); + DoWrite(nl); + + outStream.Flush(); + + type = null; + start = true; + } + } + finally + { + base.Dispose(disposing); + } + } + + private void WriteHeaderEntry( + string name, + string v) { DoWrite(name + ": " + v + nl); } - private void DoWrite( - string s) + private void DoWrite( + string s) { byte[] bs = Strings.ToAsciiByteArray(s); - outStream.Write(bs, 0, bs.Length); + outStream.Write(bs, 0, bs.Length); } } } |