diff --git a/crypto/src/x509/AttributeCertificateHolder.cs b/crypto/src/x509/AttributeCertificateHolder.cs
index 3a6af4c20..04460cd59 100644
--- a/crypto/src/x509/AttributeCertificateHolder.cs
+++ b/crypto/src/x509/AttributeCertificateHolder.cs
@@ -103,7 +103,7 @@ namespace Org.BouncyCastle.X509
// TODO Allow 'objectDigest' to be null?
holder = new Holder(new ObjectDigestInfo(digestedObjectType, otherObjectTypeID,
- new AlgorithmIdentifier(digestAlgorithm), Arrays.Clone(objectDigest)));
+ new AlgorithmIdentifier(new DerObjectIdentifier(digestAlgorithm)), Arrays.Clone(objectDigest)));
}
/**
@@ -147,7 +147,7 @@ namespace Org.BouncyCastle.X509
return odi == null
? null
- : odi.DigestAlgorithm.ObjectID.Id;
+ : odi.DigestAlgorithm.Algorithm.Id;
}
}
diff --git a/crypto/src/x509/PEMParser.cs b/crypto/src/x509/PEMParser.cs
index 8c117f323..28f28ee0a 100644
--- a/crypto/src/x509/PEMParser.cs
+++ b/crypto/src/x509/PEMParser.cs
@@ -3,6 +3,7 @@ using System.IO;
using System.Text;
using Org.BouncyCastle.Asn1;
+using Org.BouncyCastle.Utilities;
using Org.BouncyCastle.Utilities.Encoders;
namespace Org.BouncyCastle.X509
@@ -59,7 +60,7 @@ namespace Org.BouncyCastle.X509
while ((line = ReadLine(inStream)) != null)
{
- if (line.StartsWith(_header1) || line.StartsWith(_header2))
+ if (Platform.StartsWith(line, _header1) || Platform.StartsWith(line, _header2))
{
break;
}
@@ -67,7 +68,7 @@ namespace Org.BouncyCastle.X509
while ((line = ReadLine(inStream)) != null)
{
- if (line.StartsWith(_footer1) || line.StartsWith(_footer2))
+ if (Platform.StartsWith(line, _footer1) || Platform.StartsWith(line, _footer2))
{
break;
}
diff --git a/crypto/src/x509/SubjectPublicKeyInfoFactory.cs b/crypto/src/x509/SubjectPublicKeyInfoFactory.cs
index bb6f37831..7614321d4 100644
--- a/crypto/src/x509/SubjectPublicKeyInfoFactory.cs
+++ b/crypto/src/x509/SubjectPublicKeyInfoFactory.cs
@@ -1,7 +1,4 @@
using System;
-using System.IO;
-using System.Collections;
-using System.Text;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Asn1;
@@ -167,7 +164,7 @@ namespace Org.BouncyCastle.X509
return new SubjectPublicKeyInfo(algID, new DerOctetString(keyBytes));
}
- throw new ArgumentException("Class provided no convertible: " + key.GetType().FullName);
+ throw new ArgumentException("Class provided no convertible: " + Platform.GetTypeName(key));
}
private static void ExtractBytes(
diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs
index fc7f96aa9..6d7bd7a61 100644
--- a/crypto/src/x509/X509Certificate.cs
+++ b/crypto/src/x509/X509Certificate.cs
@@ -237,16 +237,16 @@ namespace Org.BouncyCastle.X509
/// <returns>A byte array containg the signature of the certificate.</returns>
public virtual byte[] GetSignature()
{
- return c.Signature.GetBytes();
+ return c.GetSignatureOctets();
}
- /// <summary>
+ /// <summary>
/// A meaningful version of the Signature Algorithm. (EG SHA1WITHRSA)
/// </summary>
/// <returns>A sting representing the signature algorithm.</returns>
public virtual string SigAlgName
{
- get { return SignerUtilities.GetEncodingName(c.SignatureAlgorithm.ObjectID); }
+ get { return SignerUtilities.GetEncodingName(c.SignatureAlgorithm.Algorithm); }
}
/// <summary>
@@ -255,7 +255,7 @@ namespace Org.BouncyCastle.X509
/// <returns>A string containg a '.' separated object id.</returns>
public virtual string SigAlgOid
{
- get { return c.SignatureAlgorithm.ObjectID.Id; }
+ get { return c.SignatureAlgorithm.Algorithm.Id; }
}
/// <summary>
@@ -586,7 +586,7 @@ namespace Org.BouncyCastle.X509
private static bool IsAlgIDEqual(AlgorithmIdentifier id1, AlgorithmIdentifier id2)
{
- if (!id1.ObjectID.Equals(id2.ObjectID))
+ if (!id1.Algorithm.Equals(id2.Algorithm))
return false;
Asn1Encodable p1 = id1.Parameters;
diff --git a/crypto/src/x509/X509Crl.cs b/crypto/src/x509/X509Crl.cs
index 53de3e91f..ecfb14132 100644
--- a/crypto/src/x509/X509Crl.cs
+++ b/crypto/src/x509/X509Crl.cs
@@ -211,7 +211,7 @@ namespace Org.BouncyCastle.X509
public virtual byte[] GetSignature()
{
- return c.Signature.GetBytes();
+ return c.GetSignatureOctets();
}
public virtual string SigAlgName
@@ -221,7 +221,7 @@ namespace Org.BouncyCastle.X509
public virtual string SigAlgOid
{
- get { return c.SignatureAlgorithm.ObjectID.Id; }
+ get { return c.SignatureAlgorithm.Algorithm.Id; }
}
public virtual byte[] GetSigAlgParams()
diff --git a/crypto/src/x509/X509SignatureUtil.cs b/crypto/src/x509/X509SignatureUtil.cs
index 7a4ab1448..83863aee1 100644
--- a/crypto/src/x509/X509SignatureUtil.cs
+++ b/crypto/src/x509/X509SignatureUtil.cs
@@ -34,7 +34,7 @@ namespace Org.BouncyCastle.X509
// throw new SignatureException("IOException decoding parameters: " + e.Message);
// }
//
-// if (signature.getAlgorithm().EndsWith("MGF1"))
+// if (Platform.EndsWith(signature.getAlgorithm(), "MGF1"))
// {
// try
// {
@@ -55,13 +55,13 @@ namespace Org.BouncyCastle.X509
if (parameters != null && !derNull.Equals(parameters))
{
- if (sigAlgId.ObjectID.Equals(PkcsObjectIdentifiers.IdRsassaPss))
+ if (sigAlgId.Algorithm.Equals(PkcsObjectIdentifiers.IdRsassaPss))
{
RsassaPssParameters rsaParams = RsassaPssParameters.GetInstance(parameters);
- return GetDigestAlgName(rsaParams.HashAlgorithm.ObjectID) + "withRSAandMGF1";
+ return GetDigestAlgName(rsaParams.HashAlgorithm.Algorithm) + "withRSAandMGF1";
}
- if (sigAlgId.ObjectID.Equals(X9ObjectIdentifiers.ECDsaWithSha2))
+ if (sigAlgId.Algorithm.Equals(X9ObjectIdentifiers.ECDsaWithSha2))
{
Asn1Sequence ecDsaParams = Asn1Sequence.GetInstance(parameters);
@@ -69,7 +69,7 @@ namespace Org.BouncyCastle.X509
}
}
- return sigAlgId.ObjectID.Id;
+ return sigAlgId.Algorithm.Id;
}
/**
diff --git a/crypto/src/x509/X509V2AttributeCertificate.cs b/crypto/src/x509/X509V2AttributeCertificate.cs
index 9376538a1..c41b31239 100644
--- a/crypto/src/x509/X509V2AttributeCertificate.cs
+++ b/crypto/src/x509/X509V2AttributeCertificate.cs
@@ -147,9 +147,14 @@ namespace Org.BouncyCastle.X509
throw new CertificateNotYetValidException("certificate not valid until " + NotBefore);
}
+ public virtual AlgorithmIdentifier SignatureAlgorithm
+ {
+ get { return cert.SignatureAlgorithm; }
+ }
+
public virtual byte[] GetSignature()
{
- return cert.SignatureValue.GetBytes();
+ return cert.GetSignatureOctets();
}
public virtual void Verify(
|