IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
CipherBlockChaining.cs
Go to the documentation of this file.
1using System;
3
6
8{
9
13 [HideFromJava]
14 internal static class CipherBlockChaining
15 {
16
17#if FIRST_PASS == false
18
19 static AESCryptAccessor aesCryptAccessor;
20
21 static AESCryptAccessor AESCryptAccessor => JVM.Internal.BaseAccessors.Get(ref aesCryptAccessor);
22
23#endif
24
37 [MethodImpl(MethodImplOptions.AggressiveInlining)]
38 public static int DecryptAESCrypt(object self, byte[] cipher, int cipherOffset, int cipherLen, byte[] plain, int plainOffset)
39 {
40#if FIRST_PASS
41 throw new NotImplementedException();
42#else
43#if NETCOREAPP3_0_OR_GREATER
44 if (plain == cipher || self is not global::com.sun.crypto.provider.CipherBlockChaining
45 {
46 r: { } r,
47 embeddedCipher: global::com.sun.crypto.provider.AESCrypt aes
48 })
49 {
50 return -1;
51 }
52
53 var k = AESCryptAccessor.K(aes);
54
55 if (CipherBlockChaining_x86.IsSupported)
56 {
57 return CipherBlockChaining_x86.DecryptAESCrypt(cipher.AsSpan(cipherOffset), plain.AsSpan(plainOffset), k, r, cipherLen);
58 }
59
60#if NET6_0_OR_GREATER
61 if (CipherBlockChaining_Arm.IsSupported)
62 {
63 return CipherBlockChaining_Arm.DecryptAESCrypt(cipher.AsSpan(cipherOffset), plain.AsSpan(plainOffset), k, r, cipherLen);
64 }
65#endif
66#endif
67
68 return -1;
69#endif
70 }
71
84 [MethodImpl(MethodImplOptions.AggressiveInlining)]
85 public static int EncryptAESCrypt(object self, byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset)
86 {
87#if FIRST_PASS
88 throw new NotImplementedException();
89#else
90#if NETCOREAPP3_0_OR_GREATER
91 if (self is not global::com.sun.crypto.provider.CipherBlockChaining
92 {
93 r: { } r,
94 embeddedCipher: global::com.sun.crypto.provider.AESCrypt aes
95 })
96 {
97 return -1;
98 }
99
100 var k = AESCryptAccessor.K(aes);
101
102 if (AESCrypt_x86.IsSupported)
103 {
104 return CipherBlockChaining_x86.EncryptAESCrypt(plain.AsSpan(plainOffset), cipher.AsSpan(cipherOffset), k, r, plainLen);
105 }
106
107#if NET6_0_OR_GREATER
108 if (CipherBlockChaining_Arm.IsSupported)
109 {
110 return CipherBlockChaining_Arm.EncryptAESCrypt(plain.AsSpan(plainOffset), cipher.AsSpan(cipherOffset), k, r, plainLen);
111 }
112#endif
113#endif
114
115 return -1;
116#endif
117 }
118
119 }
120
121}
Main state of the running JVM.