Example #1
0
        internal static int CalculateStrongNameSignatureSize(CommonPEModuleBuilder module, RSAParameters?privateKey)
        {
            ISourceAssemblySymbolInternal?assembly = module.SourceAssemblyOpt;

            if (assembly == null && !privateKey.HasValue)
            {
                return(0);
            }

            int keySize = 0;

            // EDMAURER the count of characters divided by two because the each pair of characters will turn in to one byte.
            if (keySize == 0 && assembly != null)
            {
                keySize = (assembly.SignatureKey == null) ? 0 : assembly.SignatureKey.Length / 2;
            }

            if (keySize == 0 && assembly != null)
            {
                keySize = assembly.Identity.PublicKey.Length;
            }

            if (keySize == 0 && privateKey.HasValue)
            {
                keySize = privateKey.Value.Modulus.Length;
            }

            if (keySize == 0)
            {
                return(0);
            }

            return((keySize < 128 + 32) ? 128 : keySize - 32);
        }
Example #2
0
 internal Cci.ManagedResource ToManagedResource(CommonPEModuleBuilder moduleBeingBuilt)
 {
     return(new Cci.ManagedResource(
                ResourceName,
                IsPublic,
                IsEmbedded ? DataProvider : null,
                IsEmbedded ? null : this,
                offset: 0
                ));
 }